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.



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

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

Instance Method Details

#gitaly_omnibusObject



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
106
107
108
# File 'lib/gitlab/qa/scenario/test/integration/mtls.rb', line 78

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

rubocop:enable Metrics/AbcSize



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

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

rubocop:disable Metrics/AbcSize



17
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
58
59
# File 'lib/gitlab/qa/scenario/test/integration/mtls.rb', line 17

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.set_accept_insecure_certs
    gitaly.omnibus_config = gitaly_omnibus
    gitaly.mtls

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

        gitlab.set_accept_insecure_certs
        gitlab.omnibus_config = gitlab_omnibus
        gitlab.tls = true
        gitlab.set_trusted_certificates

        gitlab.instance do
          puts "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
            specs.mtls
          end
        end
      end
    end
  end
end