gitlab-qa 4.2.2 → 4.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b28724b26e74b052e4d47355d5b3c1436caafc8ede501d897435f2775df3a3e
4
- data.tar.gz: e3309b6a55190d743cb35577345987802d5b239bdede3e2fc17b2bb9f5685465
3
+ metadata.gz: 046b62bccb952e70582f416d33a6d8e91812cecd62b6b824fe32502dfb6fa98b
4
+ data.tar.gz: af1b0fd85c07dfca53d920a7e3ee1da9d28a06ed7c5401ba1e0f94c6b753d8be
5
5
  SHA512:
6
- metadata.gz: 270b33c36d00ddc23b14abd5a3b9f0f58b00782bcfd0f39afb530194a52a37335cd98eb1756d358a2fdd4420abd25fc423a98f2e57c5fe9e39e24e3b9c40c5da
7
- data.tar.gz: 5723399e6aeb0980f050d05ce640616224f4e66b5f4c50311e21440e5430dff840751aba88ecf2276cfd60b5276c6029f0079182a0e7db37ca4d776ff8097dcb
6
+ metadata.gz: 6e1a3cbb30e225c1f9bd98be82eecf5a26c1c00a363f09b2934df98857803936f3a71afac09d8a1eba202ddcc64684a97f0c61d53ac4ce34dbfa5c2a87e99fb1
7
+ data.tar.gz: e16f0d7166c8cb3c5af3a8af06269f256f4f3f95b2e96631b4d6a794fd99559e496d66873d38aa424466625b1ff33ee9f134baaaf8e5c8d6e0a90e4a19f99ee6
data/.gitlab-ci.yml CHANGED
@@ -359,6 +359,21 @@ ee:ldap_tls-quarantine:
359
359
  <<: *ee-qa
360
360
  <<: *quarantine
361
361
 
362
+ ee:ldap_no_server:
363
+ script:
364
+ - exe/gitlab-qa Test::Integration::LDAPNoServer ${RELEASE:=EE}
365
+ <<: *test
366
+ <<: *high-capacity
367
+ <<: *ee-qa
368
+
369
+ ee:ldap_no_server-quarantine:
370
+ script:
371
+ - exe/gitlab-qa Test::Integration::LDAPNoServer ${RELEASE:=EE} -- --tag quarantine
372
+ <<: *test
373
+ <<: *high-capacity
374
+ <<: *ee-qa
375
+ <<: *quarantine
376
+
362
377
  ce:instance_saml:
363
378
  script:
364
379
  - exe/gitlab-qa Test::Integration::InstanceSAML ${RELEASE:=CE}
@@ -253,6 +253,38 @@ $ gitlab-qa Test::Integration::LDAPTLS EE
253
253
  [test-integration-ldap-tls]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/qa/qa/scenario/test/integration/ldap_tls.rb
254
254
  [test-integration-ldap-tls-certs]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/tls_certificates/gitlab
255
255
 
256
+ ### `Test::Integration::LDAPNoServer EE|<full image address>`
257
+
258
+ This configures a GitLab instance for use with LDAP but does not
259
+ spin up an LDAP server in a docker container.
260
+
261
+ The LDAP server is created at runtime by the spec so that
262
+ the test can provide the fixture data for the LDAP server
263
+ as needed.
264
+
265
+ To run tests against the GitLab containers, a GitLab QA (`gitlab/gitlab-qa`)
266
+ container is spun up and tests are run from it by running the
267
+ `Test::Integration::LDAPNoServer` scenario (located under
268
+ [`gitlab-org/gitlab@qa/qa/scenario/test/integration/ldap_no_server.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/qa/qa/scenario/test/integration/ldap_no_server.rb)
269
+ in the GitLab project).
270
+
271
+ In GiLab project, both the GitLab standard and LDAP credentials are needed:
272
+
273
+ 1. The first is used to login as an Admin to enter in the GitLab license.
274
+ 2. The second is used to conduct LDAP-related tasks
275
+
276
+ **Required environment variables:**
277
+
278
+ - `EE_LICENSE`: A valid Enterprise license.
279
+
280
+ Example:
281
+
282
+ ```
283
+ $ export EE_LICENSE=$(cat /path/to/GitLab.gitlab_license)
284
+
285
+ $ gitlab-qa Test::Integration::LDAPNoServer EE
286
+ ```
287
+
256
288
  ### `Test::Integration::GroupSAML EE|<full image address>`
257
289
 
258
290
  This tests that Group SAML login works as expected with an external SAML identity provider (idp).
data/lib/gitlab/qa.rb CHANGED
@@ -33,6 +33,7 @@ module Gitlab
33
33
  autoload :Geo, 'gitlab/qa/scenario/test/integration/geo'
34
34
  autoload :LDAP, 'gitlab/qa/scenario/test/integration/ldap'
35
35
  autoload :LDAPNoTLS, 'gitlab/qa/scenario/test/integration/ldap_no_tls'
36
+ autoload :LDAPNoServer, 'gitlab/qa/scenario/test/integration/ldap_no_server'
36
37
  autoload :LDAPTLS, 'gitlab/qa/scenario/test/integration/ldap_tls'
37
38
  autoload :SAML, 'gitlab/qa/scenario/test/integration/saml'
38
39
  autoload :GroupSAML, 'gitlab/qa/scenario/test/integration/group_saml'
@@ -20,18 +20,9 @@ module Gitlab
20
20
 
21
21
  LDAP_IMAGE = 'osixia/openldap'.freeze
22
22
  LDAP_IMAGE_TAG = 'latest'.freeze
23
- LDAP_DOMAIN = 'example.org'.freeze
24
- ADMIN_USER = 'admin'.freeze
25
- ADMIN_PASSWORD = 'admin'.freeze
26
23
  LDAP_USER = 'tanuki'.freeze
27
24
  LDAP_PASSWORD = 'password'.freeze
28
- LDAP_PORT = 389
29
- LDAP_TLS_PORT = 636
30
- BASE_DN = 'dc=example,dc=org'.freeze
31
- BIND_DN = 'cn=admin,dc=example,dc=org'.freeze
32
25
  BOOTSTRAP_LDIF = '/container/service/slapd/assets/config/bootstrap/ldif/custom'.freeze
33
- GROUP_BASE = 'ou=Global Groups,dc=example,dc=org'.freeze
34
- ADMIN_GROUP = 'AdminGroup'.freeze
35
26
  FIXTURE_PATH = File.expand_path('../../../../fixtures/ldap'.freeze, __dir__)
36
27
 
37
28
  attr_reader :docker
@@ -59,10 +50,6 @@ module Gitlab
59
50
  end
60
51
  end
61
52
 
62
- def tls?
63
- @environment['LDAP_TLS'] != 'false'
64
- end
65
-
66
53
  def username
67
54
  LDAP_USER
68
55
  end
@@ -140,37 +127,10 @@ module Gitlab
140
127
  @docker.pull(LDAP_IMAGE, LDAP_IMAGE_TAG)
141
128
  end
142
129
 
143
- def to_config
144
- config = YAML.safe_load <<~CFG
145
- main:
146
- label: LDAP
147
- host: #{hostname}
148
- port: #{tls? ? LDAP_TLS_PORT : LDAP_PORT}
149
- uid: 'uid'
150
- bind_dn: #{BIND_DN}
151
- password: #{ADMIN_PASSWORD}
152
- encryption: #{tls? ? 'simple_tls' : 'plain'}
153
- verify_certificates: false
154
- base: #{BASE_DN}
155
- user_filter: ''
156
- group_base: #{GROUP_BASE}
157
- admin_group: #{ADMIN_GROUP}
158
- external_groups: ''
159
- sync_ssh_keys: false
160
- CFG
161
-
162
- # Quotes get eaten up when the string is set in the environment
163
- config.to_s.gsub("\"", "\\\"")
164
- end
165
-
166
130
  def set_gitlab_credentials
167
131
  ::Gitlab::QA::Runtime::Env.ldap_username = username
168
132
  ::Gitlab::QA::Runtime::Env.ldap_password = password
169
133
  end
170
-
171
- def set_accept_insecure_certs
172
- ::Gitlab::QA::Runtime::Env.accept_insecure_certs = 'true'
173
- end
174
134
  end
175
135
  end
176
136
  end
@@ -8,10 +8,11 @@ module Gitlab
8
8
  # the `qa/` directory located in GitLab CE / EE repositories.
9
9
  #
10
10
  class Specs < Scenario::Template
11
- attr_accessor :suite, :release, :network, :args
11
+ attr_accessor :suite, :release, :network, :args, :volumes
12
12
 
13
13
  def initialize
14
14
  @docker = Docker::Engine.new
15
+ @volumes = {}
15
16
  end
16
17
 
17
18
  def perform # rubocop:disable Metrics/AbcSize
@@ -29,7 +30,11 @@ module Gitlab
29
30
  end
30
31
 
31
32
  command.volume('/var/run/docker.sock', '/var/run/docker.sock')
32
- command.volume(File.join(Runtime::Env.host_artifacts_dir, name), '/home/gitlab/qa/tmp')
33
+ command.volume(File.join(Runtime::Env.host_artifacts_dir, name), File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'tmp'))
34
+
35
+ @volumes.to_h.each do |to, from|
36
+ command.volume(to, from)
37
+ end
33
38
 
34
39
  command.name(name)
35
40
  end
@@ -7,6 +7,8 @@ module Gitlab
7
7
  VOLUMES = { 'config' => '/etc/gitlab',
8
8
  'data' => '/var/opt/gitlab' }.freeze
9
9
 
10
+ QA_CONTAINER_WORKDIR = '/home/gitlab/qa'.freeze
11
+
10
12
  def initialize(volumes = VOLUMES)
11
13
  @volumes = volumes
12
14
  end
@@ -6,44 +6,97 @@ module Gitlab
6
6
  module Test
7
7
  module Integration
8
8
  class LDAP < Scenario::Template
9
- attr_reader :gitlab_name, :spec_suite, :tls
9
+ LDAP_PORT = 389
10
+ LDAP_TLS_PORT = 636
11
+ BASE_DN = 'dc=example,dc=org'.freeze
12
+ BIND_DN = 'cn=admin,dc=example,dc=org'.freeze
13
+ GROUP_BASE = 'ou=Global Groups,dc=example,dc=org'.freeze
14
+ ADMIN_GROUP = 'AdminGroup'.freeze
15
+ ADMIN_USER = 'admin'.freeze
16
+ ADMIN_PASSWORD = 'admin'.freeze
10
17
 
11
- def configure(gitlab, ldap)
18
+ attr_reader :gitlab_name, :spec_suite, :tls, :ldap_name, :network, :orchestrate_ldap_server
19
+
20
+ def initialize
21
+ @ldap_name = 'ldap-server'
22
+ @network = 'test'
23
+ end
24
+
25
+ def configure_omnibus(gitlab)
12
26
  raise NotImplementedError
13
27
  end
14
28
 
15
- # rubocop:disable Metrics/AbcSize
29
+ def ldap_servers_omnibus_config
30
+ config = YAML.safe_load <<~CFG
31
+ main:
32
+ label: LDAP
33
+ host: #{ldap_hostname}
34
+ port: #{tls ? LDAP_TLS_PORT : LDAP_PORT}
35
+ uid: 'uid'
36
+ bind_dn: #{BIND_DN}
37
+ password: #{ADMIN_PASSWORD}
38
+ encryption: #{tls ? 'simple_tls' : 'plain'}
39
+ verify_certificates: false
40
+ base: #{BASE_DN}
41
+ user_filter: ''
42
+ group_base: #{GROUP_BASE}
43
+ admin_group: #{ADMIN_GROUP}
44
+ external_groups: ''
45
+ sync_ssh_keys: false
46
+ CFG
47
+
48
+ # Quotes get eaten up when the string is set in the environment
49
+ config.to_s.gsub("\"", "\\\"")
50
+ end
51
+
52
+ def ldap_hostname
53
+ "#{ldap_name}.#{network}"
54
+ end
55
+
56
+ def run_specs(gitlab, volumes = {}, *rspec_args)
57
+ gitlab.instance do
58
+ puts "Running #{spec_suite} specs!"
59
+
60
+ Component::Specs.perform do |specs|
61
+ specs.suite = spec_suite
62
+ specs.release = gitlab.release
63
+ specs.network = gitlab.network
64
+ specs.args = [gitlab.address, *rspec_args]
65
+ specs.volumes = volumes
66
+ end
67
+ end
68
+ end
69
+
70
+ def orchestrate_ldap
71
+ Component::LDAP.perform do |ldap|
72
+ ldap.name = 'ldap-server'
73
+ ldap.network = 'test'
74
+ ldap.set_gitlab_credentials
75
+ ldap.tls = tls
76
+
77
+ ldap.instance do
78
+ yield
79
+ end
80
+ end
81
+ end
82
+
16
83
  def perform(release, *rspec_args)
17
84
  Component::Gitlab.perform do |gitlab|
18
85
  gitlab.release = release
19
86
  gitlab.name = gitlab_name
20
87
  gitlab.network = 'test'
21
88
  gitlab.tls = tls
89
+ configure_omnibus(gitlab)
22
90
 
23
- Component::LDAP.perform do |ldap|
24
- ldap.name = 'ldap-server'
25
- ldap.network = 'test'
26
- ldap.set_gitlab_credentials
27
- ldap.tls = tls
28
-
29
- configure(gitlab, ldap)
30
-
31
- ldap.instance do
32
- gitlab.instance do
33
- puts "Running #{spec_suite} specs!"
34
-
35
- Component::Specs.perform do |specs|
36
- specs.suite = spec_suite
37
- specs.release = gitlab.release
38
- specs.network = gitlab.network
39
- specs.args = [gitlab.address, *rspec_args]
40
- end
41
- end
42
- end
91
+ if orchestrate_ldap_server
92
+ orchestrate_ldap { run_specs(gitlab, {}, *rspec_args) }
93
+ else
94
+ volumes = { 'admin': File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'qa/fixtures/ldap/admin'),
95
+ 'non_admin': File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'qa/fixtures/ldap/non_admin') }
96
+ run_specs(gitlab, volumes, *rspec_args)
43
97
  end
44
98
  end
45
99
  end
46
- # rubocop:enable Metrics/AbcSize
47
100
  end
48
101
  end
49
102
  end
@@ -0,0 +1,27 @@
1
+ module Gitlab
2
+ module QA
3
+ module Scenario
4
+ module Test
5
+ module Integration
6
+ class LDAPNoServer < LDAP
7
+ def initialize
8
+ @spec_suite = 'Test::Integration::LDAPNoServer'
9
+ @orchestrate_ldap_server = false
10
+ @tls = false
11
+ super
12
+ end
13
+
14
+ def configure_omnibus(gitlab)
15
+ gitlab.omnibus_config = <<~OMNIBUS
16
+ gitlab_rails['ldap_enabled'] = true;
17
+ gitlab_rails['ldap_servers'] = #{ldap_servers_omnibus_config};
18
+ gitlab_rails['ldap_sync_worker_cron'] = '* * * * *';
19
+ gitlab_rails['ldap_group_sync_worker_cron'] = '* * * * *';
20
+ OMNIBUS
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -9,13 +9,15 @@ module Gitlab
9
9
  def initialize
10
10
  @gitlab_name = 'gitlab-ldap'
11
11
  @spec_suite = 'Test::Integration::LDAPNoTLS'
12
+ @orchestrate_ldap_server = true
12
13
  @tls = false
14
+ super
13
15
  end
14
16
 
15
- def configure(gitlab, ldap)
17
+ def configure_omnibus(gitlab)
16
18
  gitlab.omnibus_config = <<~OMNIBUS
17
19
  gitlab_rails['ldap_enabled'] = true;
18
- gitlab_rails['ldap_servers'] = #{ldap.to_config};
20
+ gitlab_rails['ldap_servers'] = #{ldap_servers_omnibus_config};
19
21
  gitlab_rails['ldap_sync_worker_cron'] = '* * * * *';
20
22
  gitlab_rails['ldap_group_sync_worker_cron'] = '* * * * *';
21
23
  OMNIBUS
@@ -9,14 +9,20 @@ module Gitlab
9
9
  def initialize
10
10
  @gitlab_name = 'gitlab'
11
11
  @spec_suite = 'Test::Integration::LDAPTLS'
12
+ @orchestrate_ldap_server = true
12
13
  @tls = true
14
+ super
13
15
  end
14
16
 
15
- def configure(gitlab, ldap)
16
- ldap.set_accept_insecure_certs
17
+ def set_accept_insecure_certs
18
+ ::Gitlab::QA::Runtime::Env.accept_insecure_certs = 'true'
19
+ end
20
+
21
+ def configure_omnibus(gitlab)
22
+ set_accept_insecure_certs
17
23
  gitlab.omnibus_config = <<~OMNIBUS
18
24
  gitlab_rails['ldap_enabled'] = true;
19
- gitlab_rails['ldap_servers'] = #{ldap.to_config};
25
+ gitlab_rails['ldap_servers'] = #{ldap_servers_omnibus_config};
20
26
  letsencrypt['enable'] = false;
21
27
  external_url '#{gitlab.address}';
22
28
  gitlab_rails['ldap_sync_worker_cron'] = '* * * * *';
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '4.2.2'.freeze
3
+ VERSION = '4.3.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2
4
+ version: 4.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Bizon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-12 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -195,6 +195,7 @@ files:
195
195
  - lib/gitlab/qa/scenario/test/integration/instance_saml.rb
196
196
  - lib/gitlab/qa/scenario/test/integration/kubernetes.rb
197
197
  - lib/gitlab/qa/scenario/test/integration/ldap.rb
198
+ - lib/gitlab/qa/scenario/test/integration/ldap_no_server.rb
198
199
  - lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb
199
200
  - lib/gitlab/qa/scenario/test/integration/ldap_tls.rb
200
201
  - lib/gitlab/qa/scenario/test/integration/mattermost.rb
@@ -227,8 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
228
  - !ruby/object:Gem::Version
228
229
  version: '0'
229
230
  requirements: []
230
- rubyforge_project:
231
- rubygems_version: 2.7.6
231
+ rubygems_version: 3.0.6
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: Integration tests for GitLab