Class: Gitlab::QA::Scenario::Test::Integration::MTLS

Inherits:
Gitlab::QA::Scenario::Template show all
Defined in:
lib/gitlab/qa/scenario/test/integration/mtls.rb

Instance Method Summary collapse

Methods inherited from Gitlab::QA::Scenario::Template

perform

Constructor Details

#initializeMTLS

Returns a new instance of MTLS.



9
10
11
12
13
14
15
16
# File 'lib/gitlab/qa/scenario/test/integration/mtls.rb', line 9

def initialize
  @gitlab_name = 'gitlab'
  @gitaly_name = 'gitaly'
  @spec_suite = 'Test::Instance::All'
  @network = 'test'
  @env = {}
  @tag = 'mtls'
end

Instance Method Details

#gitaly_omnibusObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/gitlab/qa/scenario/test/integration/mtls.rb', line 75

def gitaly_omnibus
  <<~OMNIBUS
    gitaly['tls_listen_addr'] = '0.0.0.0:9999';
    gitaly['certificate_path'] = '/etc/gitlab/ssl/gitaly.test.crt';
    gitaly['key_path'] = '/etc/gitlab/ssl/gitaly.test.key';

    postgresql['enable'] = false;
    redis['enable'] = false;
    nginx['enable'] = false;
    puma['enable'] = false;
    sidekiq['enable'] = false;
    gitlab_workhorse['enable'] = false;
    grafana['enable'] = false;
    gitlab_exporter['enable'] = false;
    alertmanager['enable'] = false;
    prometheus['enable'] = false;

    gitlab_rails['rake_cache_clear'] = false;
    gitlab_rails['auto_migrate'] = false;

    gitaly['auth_token'] = 'abc123secret';
    gitlab_shell['secret_token'] = 'shellsecret';

    gitlab_rails['internal_api_url'] = 'https://#{@gitlab_name}.#{@network}';

    git_data_dirs({
      'default' => { 'path' => '/var/opt/gitlab/git-data' },
      'storage1' => { 'path' => '/mnt/gitlab/git-data' },
    })
  OMNIBUS
end

#gitlab_omnibusObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/gitlab/qa/scenario/test/integration/mtls.rb', line 59

def gitlab_omnibus
  <<~OMNIBUS
    gitaly['enable'] = false;

    external_url 'https://#{@gitlab_name}.#{@network}';

    gitlab_rails['gitaly_token'] = 'abc123secret';
    gitlab_shell['secret_token'] = 'shellsecret';

    git_data_dirs({
      'default' => { 'gitaly_address' => 'tls://#{@gitaly_name}.#{@network}:9999' },
      'storage1' => { 'gitaly_address' => 'tls://#{@gitaly_name}.#{@network}:9999' },
    });
  OMNIBUS
end

#perform(release, *rspec_args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/gitlab/qa/scenario/test/integration/mtls.rb', line 18

def perform(release, *rspec_args)
  Component::Gitlab.perform do |gitaly|
    gitaly.release = QA::Release.new(release)
    gitaly.name = @gitaly_name
    gitaly.network = @network
    gitaly.skip_availability_check = true
    gitaly.seed_admin_token = false

    gitaly.omnibus_configuration << gitaly_omnibus
    gitaly.gitaly_tls

    gitaly.instance do
      Component::Gitlab.perform do |gitlab|
        gitlab.release = QA::Release.new(release)
        gitlab.name = @gitlab_name
        gitlab.network = @network

        gitlab.omnibus_configuration << gitlab_omnibus
        gitlab.tls = true

        gitlab.instance do
          Runtime::Logger.info("Running mTLS specs!")

          if @tag
            rspec_args << "--" unless rspec_args.include?('--')
            rspec_args << "--tag" << @tag
          end

          Component::Specs.perform do |specs|
            specs.suite = @spec_suite
            specs.release = gitlab.release
            specs.network = gitlab.network
            specs.args = [gitlab.address, *rspec_args]
            specs.env = @env
          end
        end
      end
    end
  end
end