gitlab-qa 7.34.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab/ci/jobs/registry_with_cdn.gitlab-ci.yml +12 -0
  3. data/.rubocop_todo.yml +15 -30
  4. data/Dangerfile +2 -0
  5. data/Gemfile +2 -0
  6. data/Gemfile.lock +3 -2
  7. data/Rakefile +2 -0
  8. data/docs/run_qa_against_gdk.md +5 -0
  9. data/exe/gitlab-qa +1 -0
  10. data/exe/gitlab-qa-report +1 -0
  11. data/gitlab-qa.gemspec +1 -0
  12. data/lib/gitlab/qa/component/base.rb +3 -1
  13. data/lib/gitlab/qa/component/elasticsearch.rb +3 -1
  14. data/lib/gitlab/qa/component/gitlab.rb +42 -24
  15. data/lib/gitlab/qa/component/internet_tunnel.rb +4 -2
  16. data/lib/gitlab/qa/component/jira.rb +4 -2
  17. data/lib/gitlab/qa/component/mail_hog.rb +3 -2
  18. data/lib/gitlab/qa/component/minio.rb +7 -5
  19. data/lib/gitlab/qa/component/postgresql.rb +4 -2
  20. data/lib/gitlab/qa/component/preprod.rb +3 -1
  21. data/lib/gitlab/qa/component/production.rb +3 -1
  22. data/lib/gitlab/qa/component/release.rb +3 -1
  23. data/lib/gitlab/qa/component/saml.rb +4 -2
  24. data/lib/gitlab/qa/component/specs.rb +2 -0
  25. data/lib/gitlab/qa/component/staging.rb +4 -2
  26. data/lib/gitlab/qa/component/staging_ref.rb +4 -2
  27. data/lib/gitlab/qa/docker/command.rb +7 -1
  28. data/lib/gitlab/qa/docker/engine.rb +10 -0
  29. data/lib/gitlab/qa/docker/shellout.rb +24 -14
  30. data/lib/gitlab/qa/docker/volumes.rb +3 -1
  31. data/lib/gitlab/qa/release.rb +6 -4
  32. data/lib/gitlab/qa/report/{junit_test_results.rb → j_unit_test_results.rb} +0 -0
  33. data/lib/gitlab/qa/report/prepare_stage_reports.rb +2 -0
  34. data/lib/gitlab/qa/report/summary_table.rb +2 -0
  35. data/lib/gitlab/qa/report/update_screenshot_path.rb +2 -0
  36. data/lib/gitlab/qa/reporter.rb +2 -0
  37. data/lib/gitlab/qa/runtime/env.rb +9 -4
  38. data/lib/gitlab/qa/scenario/actable.rb +2 -0
  39. data/lib/gitlab/qa/scenario/cli_commands.rb +3 -1
  40. data/lib/gitlab/qa/scenario/template.rb +2 -0
  41. data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +2 -0
  42. data/lib/gitlab/qa/scenario/test/instance/any.rb +2 -0
  43. data/lib/gitlab/qa/scenario/test/instance/deployment_base.rb +2 -0
  44. data/lib/gitlab/qa/scenario/test/instance/geo.rb +2 -0
  45. data/lib/gitlab/qa/scenario/test/instance/image.rb +2 -0
  46. data/lib/gitlab/qa/scenario/test/instance/preprod.rb +2 -0
  47. data/lib/gitlab/qa/scenario/test/instance/production.rb +2 -0
  48. data/lib/gitlab/qa/scenario/test/instance/relative_url.rb +2 -0
  49. data/lib/gitlab/qa/scenario/test/instance/release.rb +2 -0
  50. data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +2 -0
  51. data/lib/gitlab/qa/scenario/test/instance/smoke.rb +2 -0
  52. data/lib/gitlab/qa/scenario/test/instance/staging.rb +2 -0
  53. data/lib/gitlab/qa/scenario/test/instance/staging_geo.rb +2 -0
  54. data/lib/gitlab/qa/scenario/test/instance/staging_ref.rb +2 -0
  55. data/lib/gitlab/qa/scenario/test/instance/staging_ref_geo.rb +2 -0
  56. data/lib/gitlab/qa/scenario/test/integration/client_ssl.rb +2 -0
  57. data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +2 -0
  58. data/lib/gitlab/qa/scenario/test/integration/geo.rb +2 -0
  59. data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +2 -0
  60. data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +2 -0
  61. data/lib/gitlab/qa/scenario/test/integration/instance_saml.rb +2 -0
  62. data/lib/gitlab/qa/scenario/test/integration/jira.rb +2 -0
  63. data/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +2 -0
  64. data/lib/gitlab/qa/scenario/test/integration/ldap.rb +8 -6
  65. data/lib/gitlab/qa/scenario/test/integration/ldap_no_server.rb +2 -0
  66. data/lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb +2 -0
  67. data/lib/gitlab/qa/scenario/test/integration/ldap_tls.rb +2 -0
  68. data/lib/gitlab/qa/scenario/test/integration/mattermost.rb +2 -0
  69. data/lib/gitlab/qa/scenario/test/integration/mtls.rb +2 -0
  70. data/lib/gitlab/qa/scenario/test/integration/praefect.rb +2 -0
  71. data/lib/gitlab/qa/scenario/test/integration/saml.rb +2 -0
  72. data/lib/gitlab/qa/scenario/test/integration/smtp.rb +2 -0
  73. data/lib/gitlab/qa/scenario/test/omnibus/image.rb +2 -0
  74. data/lib/gitlab/qa/scenario/test/omnibus/update.rb +2 -0
  75. data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +2 -0
  76. data/lib/gitlab/qa/scenario/test/sanity/version.rb +2 -0
  77. data/lib/gitlab/qa/slack/post_to_slack.rb +2 -0
  78. data/lib/gitlab/qa/support/dev_ee_qa_image.rb +3 -1
  79. data/lib/gitlab/qa/support/get_request.rb +2 -0
  80. data/lib/gitlab/qa/support/http_request.rb +2 -0
  81. data/lib/gitlab/qa/support/invalid_response_error.rb +2 -0
  82. data/lib/gitlab/qa/test_logger.rb +1 -1
  83. data/lib/gitlab/qa/version.rb +1 -1
  84. data/lib/gitlab/qa.rb +53 -143
  85. data/scripts/generate-qa-jobs.rb +1 -0
  86. data/support/data/admin_access_token_seed.rb +1 -1
  87. data/support/data/license_usage_seed.rb +2 -1
  88. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 917c47b2fbead3c77db3cd6c441995a8324ed73735262542dcd94de854022a35
4
- data.tar.gz: 7785db11c9eb0f1f7ff2ecf32b16b8fd95ad9bab9391711f2d0af05a7e903153
3
+ metadata.gz: '0982270bb1256eb950e30c84028a70fca0663c744fff1bf00cb1937f89936f43'
4
+ data.tar.gz: c2051a27b8027df5d47359a6b27a54338e25bfc37471dae2fe600087e118b392
5
5
  SHA512:
6
- metadata.gz: c509e252f4bd1e7d405d517920e306e2cdf5233cd73a5fbf25a878cbb863a7c21e5fedb007c8ef461f7e34e1899b27ff989d92182c427575a125f4c99a39de9d
7
- data.tar.gz: 9011ddab65c7c0218ed49a5cbd2cdaa26f2b2ce013eb005d9ba63ee067ce18306bf8475861156ca52d7e2272cc9c94588ac86016e90e7901ecdac94d4e2f6cbf
6
+ metadata.gz: c11dd80b24b285fcd8b93c94c0fabac93be215576eb307804c485ad9a5dbba4a7b6cd9f6b016f13082ba4c146f8189a2e7f6bf9b41ef85172a735696e2e558af
7
+ data.tar.gz: 0cf57dcfa1f30e37f2acc66015ed03c0d2e3d2bd65284f7be92d71b1028fadbceb9f72feaa7a4dad29905d7554a9f985885b6d95ca096944c1a955ffa0ac244d
@@ -1,4 +1,7 @@
1
1
  ce:registry_with_cdn:
2
+ before_script:
3
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
4
+ - !reference [default, before_script]
2
5
  extends:
3
6
  - .rules:ce-never-when-triggered-by-feature-flag-definition-change
4
7
  - .test
@@ -10,6 +13,9 @@ ce:registry_with_cdn:
10
13
  allow_failure: true
11
14
 
12
15
  ce:registry_with_cdn-quarantine:
16
+ before_script:
17
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
18
+ - !reference [default, before_script]
13
19
  extends:
14
20
  - .rules:ce-never-when-triggered-by-feature-flag-definition-change
15
21
  - .test
@@ -21,6 +27,9 @@ ce:registry_with_cdn-quarantine:
21
27
  QA_SCENARIO: "Test::Integration::RegistryWithCDN"
22
28
 
23
29
  ee:registry_with_cdn:
30
+ before_script:
31
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
32
+ - !reference [default, before_script]
24
33
  extends:
25
34
  - .rules:ee-never-when-triggered-by-feature-flag-definition-change
26
35
  - .test
@@ -32,6 +41,9 @@ ee:registry_with_cdn:
32
41
  allow_failure: true
33
42
 
34
43
  ee:registry_with_cdn-quarantine:
44
+ before_script:
45
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
46
+ - !reference [default, before_script]
35
47
  extends:
36
48
  - .rules:ee-never-when-triggered-by-feature-flag-definition-change
37
49
  - .test
data/.rubocop_todo.yml CHANGED
@@ -1,22 +1,21 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-09-17 06:55:33 UTC using RuboCop version 0.93.1.
3
+ # on 2022-06-21 18:16:41 UTC using RuboCop version 0.93.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 165
9
+ # Offense count: 199
10
10
  # Cop supports --auto-correct.
11
11
  CodeReuse/ActiveRecord:
12
12
  Enabled: false
13
13
 
14
- # Offense count: 2
14
+ # Offense count: 1
15
15
  # Cop supports --auto-correct.
16
16
  Cop/LineBreakAroundConditionalBlock:
17
17
  Exclude:
18
18
  - 'lib/gitlab/qa/release.rb'
19
- - 'lib/gitlab/qa/runtime/env.rb'
20
19
 
21
20
  # Offense count: 1
22
21
  # Configuration parameters: Include.
@@ -44,10 +43,10 @@ Lint/RedundantCopDisableDirective:
44
43
  - 'lib/gitlab/qa/component/staging.rb'
45
44
  - 'lib/gitlab/qa/runtime/scenario.rb'
46
45
 
47
- # Offense count: 10
46
+ # Offense count: 21
48
47
  # Configuration parameters: IgnoredMethods.
49
48
  Metrics/AbcSize:
50
- Max: 26
49
+ Max: 60
51
50
  IgnoredMethods:
52
51
  - perform
53
52
 
@@ -58,24 +57,11 @@ Naming/RescuedExceptionsVariableName:
58
57
  Exclude:
59
58
  - 'lib/gitlab/qa/component/staging.rb'
60
59
 
61
- # Offense count: 1
62
- # Cop supports --auto-correct.
63
- Performance/RegexpMatch:
64
- Exclude:
65
- - 'lib/gitlab/qa/component/gitlab.rb'
66
-
67
- # Offense count: 1
68
- # Cop supports --auto-correct.
69
- # Configuration parameters: AutoCorrect.
70
- Performance/StringInclude:
71
- Exclude:
72
- - 'lib/gitlab/qa/component/gitlab.rb'
73
-
74
60
  # Offense count: 3
75
61
  # Cop supports --auto-correct.
76
62
  RSpec/EmptyLineAfterLetBlock:
77
63
  Exclude:
78
- - 'spec/gitlab/qa/support/dev_eeqa_image_spec.rb'
64
+ - 'spec/gitlab/qa/support/dev_ee_qa_image_spec.rb'
79
65
 
80
66
  # Offense count: 4
81
67
  # Cop supports --auto-correct.
@@ -84,6 +70,12 @@ RSpec/ExampleWording:
84
70
  Exclude:
85
71
  - 'spec/gitlab/qa/component/gitlab_spec.rb'
86
72
 
73
+ # Offense count: 1
74
+ # Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
75
+ RSpec/FilePath:
76
+ Exclude:
77
+ - 'spec/gitlab/qa/support/dev_ee_qa_image_spec.rb'
78
+
87
79
  # Offense count: 2
88
80
  RSpec/LeakyConstantDeclaration:
89
81
  Exclude:
@@ -95,13 +87,6 @@ Style/ExplicitBlockArgument:
95
87
  Exclude:
96
88
  - 'lib/gitlab/qa/scenario/test/integration/ldap.rb'
97
89
 
98
- # Offense count: 86
99
- # Cop supports --auto-correct.
100
- # Configuration parameters: EnforcedStyle.
101
- # SupportedStyles: always, always_true, never
102
- Style/FrozenStringLiteralComment:
103
- Enabled: false
104
-
105
90
  # Offense count: 1
106
91
  # Cop supports --auto-correct.
107
92
  Style/HashTransformKeys:
@@ -114,7 +99,7 @@ Style/HashTransformation:
114
99
  Exclude:
115
100
  - 'lib/gitlab/qa/docker/volumes.rb'
116
101
 
117
- # Offense count: 3
102
+ # Offense count: 8
118
103
  # Cop supports --auto-correct.
119
104
  Style/IfUnlessModifier:
120
105
  Exclude:
@@ -154,9 +139,9 @@ Style/StringConcatenation:
154
139
  Exclude:
155
140
  - 'lib/gitlab/qa/reporter.rb'
156
141
 
157
- # Offense count: 126
142
+ # Offense count: 191
158
143
  # Cop supports --auto-correct.
159
144
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
160
145
  # URISchemes: http, https
161
146
  Layout/LineLength:
162
- Max: 192
147
+ Max: 189
data/Dangerfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gitlab-dangerfiles'
2
4
 
3
5
  Gitlab::Dangerfiles.for_project(self) do |dangerfiles|
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (7.34.0)
4
+ gitlab-qa (8.0.0)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
8
8
  nokogiri (~> 1.10)
9
9
  rainbow (~> 3.0.0)
10
10
  table_print (= 1.5.7)
11
+ zeitwerk (~> 2.4)
11
12
 
12
13
  GEM
13
14
  remote: https://rubygems.org/
@@ -245,4 +246,4 @@ DEPENDENCIES
245
246
  webmock (= 3.7.0)
246
247
 
247
248
  BUNDLED WITH
248
- 2.2.33
249
+ 2.3.9
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
@@ -120,6 +120,11 @@ This is required because chrome-webdriver makes use of `/dev/shm` shared memory.
120
120
  ~3GB but unless you allocate 5GB or more some magic numbers may not enable a bigger `/dev/shm` in the
121
121
  'host' VM that "native" docker runs on.
122
122
 
123
+ By default, Docker runs a container with a /dev/shm shared memory space 64MB.
124
+ This is typically too small for Chrome and will cause Chrome to crash when rendering large pages and fail the tests.
125
+ To fix, run the container with docker run `--shm-size=1gb` to increase the size of `/dev/shm`.
126
+ Since Chrome 65, this is no longer necessary. Instead, launch the browser with the `CHROME_DISABLE_DEV_SHM=true`.
127
+
123
128
  Please note that while it's possible to run multi-node tests like Geo Primary and Secondary, you can't
124
129
  access the machines from your host machine, as they are all exposed as `0.0.0.0:port`, and because
125
130
  of that they don't match the configured VHOSTs in your GitLab installation, so the redirect login
data/exe/gitlab-qa CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  lib = File.expand_path('../lib', __dir__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
data/exe/gitlab-qa-report CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  lib = File.expand_path('../lib', __dir__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
data/gitlab-qa.gemspec CHANGED
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency 'nokogiri', '~> 1.10'
35
35
  spec.add_runtime_dependency 'rainbow', '~> 3.0.0'
36
36
  spec.add_runtime_dependency 'table_print', '1.5.7'
37
+ spec.add_runtime_dependency 'zeitwerk', '~> 2.4'
37
38
  end
@@ -155,7 +155,9 @@ module Gitlab
155
155
  rescue Docker::Shellout::StatusError => e
156
156
  # for scenarios where a service fails during startup, attempt to retry to avoid flaky failures
157
157
  if (retries += 1) < 3
158
- puts "Retry instance_no_teardown due to Docker::Shellout::StatusError -- attempt #{retries}"
158
+ Runtime::Logger.warn(
159
+ "Retry instance_no_teardown due to Docker::Shellout::StatusError -- attempt #{retries}"
160
+ )
159
161
  teardown!
160
162
  retry
161
163
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Elasticsearch < Base
5
- DOCKER_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch'.freeze
7
+ DOCKER_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch'
6
8
 
7
9
  def name
8
10
  @name ||= "elastic68"
@@ -13,6 +13,7 @@ module Gitlab
13
13
  module Component
14
14
  class Gitlab < Base
15
15
  extend Forwardable
16
+ using Rainbow
16
17
 
17
18
  attr_reader :release, :omnibus_configuration, :omnibus_gitlab_rails_env
18
19
  attr_accessor :tls, :skip_availability_check, :runner_network, :seed_admin_token, :seed_db
@@ -121,8 +122,9 @@ module Gitlab
121
122
  def prepare_gitlab_omnibus_config
122
123
  set_formless_login_token
123
124
  set_license_mode
125
+ return if omnibus_gitlab_rails_env.empty?
124
126
 
125
- @omnibus_configuration << "gitlab_rails['env'] = #{@omnibus_gitlab_rails_env}" unless omnibus_gitlab_rails_env.empty?
127
+ @omnibus_configuration << "gitlab_rails['env'] = #{@omnibus_gitlab_rails_env}"
126
128
  end
127
129
 
128
130
  def start # rubocop:disable Metrics/AbcSize
@@ -148,7 +150,12 @@ module Gitlab
148
150
  command << "--network-alias #{network_alias}"
149
151
  end
150
152
  end
151
- Docker::Command.execute("network connect --alias #{name}.#{network} --alias #{name}.#{runner_network} #{runner_network} #{name}") if runner_network
153
+
154
+ return unless runner_network
155
+
156
+ Docker::Command.execute(
157
+ "network connect --alias #{name}.#{network} --alias #{name}.#{runner_network} #{runner_network} #{name}"
158
+ )
152
159
  end
153
160
 
154
161
  def reconfigure
@@ -163,10 +170,19 @@ module Gitlab
163
170
  def wait_until_ready
164
171
  return if skip_availability_check
165
172
 
166
- if Availability.new(name, relative_path: relative_path, scheme: scheme, protocol_port: port.to_i).check(Runtime::Env.gitlab_availability_timeout)
167
- puts ' -> GitLab is available.'
173
+ availability = Availability.new(
174
+ name,
175
+ relative_path: relative_path,
176
+ scheme: scheme,
177
+ protocol_port: port.to_i
178
+ )
179
+
180
+ Runtime::Logger.info("Waiting for GitLab to become healthy ...")
181
+
182
+ if availability.check(Runtime::Env.gitlab_availability_timeout)
183
+ Runtime::Logger.info("-> GitLab is available at `#{availability.uri}`!".bright)
168
184
  else
169
- abort ' -> GitLab unavailable!'
185
+ abort '-> GitLab unavailable!'.red
170
186
  end
171
187
  end
172
188
 
@@ -260,7 +276,10 @@ module Gitlab
260
276
  [
261
277
  @docker.exec(name, 'mkdir -p /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d'),
262
278
  @docker.write_files(name) do |f|
263
- f.write('/opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/pre-receive.d', global_server_prereceive_hook, false)
279
+ f.write(
280
+ '/opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/pre-receive.d',
281
+ global_server_prereceive_hook, false
282
+ )
264
283
  end,
265
284
  @docker.exec(name, 'chmod +x /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/*')
266
285
  ]
@@ -270,42 +289,41 @@ module Gitlab
270
289
  def initialize(name, relative_path: '', scheme: 'http', protocol_port: 80)
271
290
  @docker = Docker::Engine.new
272
291
 
273
- host = @docker.hostname
274
- port = @docker.port(name, protocol_port).split(':').last
275
-
276
- @uri = URI.join("#{scheme}://#{host}:#{port}", "#{relative_path}/", 'help')
292
+ @name = name
293
+ @scheme = scheme
294
+ @relative_path = relative_path
295
+ @protocol_port = protocol_port
277
296
  end
278
297
 
279
298
  def check(retries)
280
- print "Waiting for GitLab at `#{@uri}` to become available "
281
-
282
299
  retries.times do
283
300
  return true if service_available?
284
301
 
285
- print '.'
286
302
  sleep 1
287
303
  end
288
304
 
289
305
  false
290
306
  end
291
307
 
308
+ def uri
309
+ @uri ||= begin
310
+ port = docker.port(name, protocol_port).split(':').last
311
+
312
+ URI.join("#{scheme}://#{docker.hostname}:#{port}", relative_path)
313
+ end
314
+ end
315
+
292
316
  private
293
317
 
318
+ attr_reader :docker, :name, :relative_path, :scheme, :protocol_port
319
+
294
320
  def service_available?
295
- response = Net::HTTP.start(@uri.host, @uri.port, opts) do |http|
296
- http.head2(@uri.request_uri)
297
- end
321
+ output = docker.inspect(name) { |command| command << "--format='{{json .State.Health.Status}}'" }
298
322
 
299
- print response.code
300
- response.code.to_i == 200
301
- rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError => e
302
- print e.message
323
+ output == '"healthy"'
324
+ rescue Docker::Shellout::StatusError
303
325
  false
304
326
  end
305
-
306
- def opts
307
- @uri.scheme == 'https' ? { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE } : {}
308
- end
309
327
  end
310
328
  end
311
329
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tempfile'
2
4
 
3
5
  module Gitlab
4
6
  module QA
5
7
  module Component
6
8
  class InternetTunnel < Base
7
- DOCKER_IMAGE = 'gitlab/ssh-tunnel'.freeze
8
- DOCKER_IMAGE_TAG = '1.0.0'.freeze
9
+ DOCKER_IMAGE = 'gitlab/ssh-tunnel'
10
+ DOCKER_IMAGE_TAG = '1.0.0'
9
11
 
10
12
  attr_writer :gitlab_hostname
11
13
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Jira < Base
5
- DOCKER_IMAGE = 'registry.gitlab.com/gitlab-org/gitlab-qa/jira-gitlab'.freeze
6
- DOCKER_IMAGE_TAG = '8.8-project-and-issue'.freeze
7
+ DOCKER_IMAGE = 'registry.gitlab.com/gitlab-org/gitlab-qa/jira-gitlab'
8
+ DOCKER_IMAGE_TAG = '8.8-project-and-issue'
7
9
 
8
10
  def name
9
11
  @name ||= "jira"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This component sets up the MailHog (https://github.com/mailhog/MailHog)
2
3
  # image with the proper configuration for SMTP email delivery from Gitlab
3
4
 
@@ -5,8 +6,8 @@ module Gitlab
5
6
  module QA
6
7
  module Component
7
8
  class MailHog < Base
8
- DOCKER_IMAGE = 'mailhog/mailhog'.freeze
9
- DOCKER_IMAGE_TAG = 'v1.0.0'.freeze
9
+ DOCKER_IMAGE = 'mailhog/mailhog'
10
+ DOCKER_IMAGE_TAG = 'v1.0.0'
10
11
 
11
12
  def name
12
13
  @name ||= "mailhog"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
  require 'fileutils'
3
5
  require 'yaml'
@@ -8,12 +10,12 @@ module Gitlab
8
10
  module QA
9
11
  module Component
10
12
  class Minio < Base
11
- DOCKER_IMAGE = 'minio/minio'.freeze
12
- DOCKER_IMAGE_TAG = 'latest'.freeze
13
+ DOCKER_IMAGE = 'minio/minio'
14
+ DOCKER_IMAGE_TAG = 'latest'
13
15
  # These are secrets used in a local Minio container, they're not used for any online S3 server.
14
- AWS_ACCESS_KEY = 'AKIAIOSFODNN7EXAMPLE'.freeze
15
- AWS_SECRET_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'.freeze
16
- DATA_DIR = '/data'.freeze
16
+ AWS_ACCESS_KEY = 'AKIAIOSFODNN7EXAMPLE'
17
+ AWS_SECRET_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
18
+ DATA_DIR = '/data'
17
19
  DEFAULT_PORT = 9000
18
20
 
19
21
  def initialize
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class PostgreSQL < Base
5
- DOCKER_IMAGE = 'postgres'.freeze
6
- DOCKER_IMAGE_TAG = '11'.freeze
7
+ DOCKER_IMAGE = 'postgres'
8
+ DOCKER_IMAGE_TAG = '11'
7
9
 
8
10
  def name
9
11
  @name ||= "postgres"
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Preprod < Staging
5
- ADDRESS = 'https://pre.gitlab.com'.freeze
7
+ ADDRESS = 'https://pre.gitlab.com'
6
8
  end
7
9
  end
8
10
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Production < Staging
5
- ADDRESS = 'https://gitlab.com'.freeze
7
+ ADDRESS = 'https://gitlab.com'
6
8
  end
7
9
  end
8
10
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Release < Staging
5
- ADDRESS = 'https://release.gitlab.net'.freeze
7
+ ADDRESS = 'https://release.gitlab.net'
6
8
  end
7
9
  end
8
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  # This component sets up the docker-test-saml-idp (https://github.com/kristophjunge/docker-test-saml-idp)
@@ -7,8 +9,8 @@ module Gitlab
7
9
  module QA
8
10
  module Component
9
11
  class SAML < Base
10
- DOCKER_IMAGE = 'jamedjo/test-saml-idp'.freeze
11
- DOCKER_IMAGE_TAG = 'latest'.freeze
12
+ DOCKER_IMAGE = 'jamedjo/test-saml-idp'
13
+ DOCKER_IMAGE_TAG = 'latest'
12
14
 
13
15
  def set_entity_id(entity_id)
14
16
  @environment['SIMPLESAMLPHP_SP_ENTITY_ID'] = entity_id
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'net/http'
2
4
  require 'json'
3
5
  require 'uri'
@@ -6,8 +8,8 @@ module Gitlab
6
8
  module QA
7
9
  module Component
8
10
  class Staging
9
- ADDRESS = 'https://staging.gitlab.com'.freeze
10
- GEO_SECONDARY_ADDRESS = 'https://geo.staging.gitlab.com'.freeze
11
+ ADDRESS = 'https://staging.gitlab.com'
12
+ GEO_SECONDARY_ADDRESS = 'https://geo.staging.gitlab.com'
11
13
 
12
14
  def self.release
13
15
  QA::Release.new(image)
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class StagingRef < Staging
5
- ADDRESS = 'https://staging-ref.gitlab.com'.freeze
6
- GEO_SECONDARY_ADDRESS = 'https://geo.staging-ref.gitlab.com'.freeze
7
+ ADDRESS = 'https://staging-ref.gitlab.com'
8
+ GEO_SECONDARY_ADDRESS = 'https://geo.staging-ref.gitlab.com'
7
9
  end
8
10
  end
9
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Docker
@@ -43,7 +45,7 @@ module Gitlab
43
45
  #
44
46
  # @return [String] The masked command string
45
47
  def mask_secrets
46
- @mask_secrets.each_with_object(to_s) { |secret, s| s.gsub!(secret, '*****') }
48
+ @mask_secrets.each_with_object(+to_s) { |secret, s| s.gsub!(secret, '*****') }
47
49
  end
48
50
 
49
51
  def ==(other)
@@ -52,6 +54,10 @@ module Gitlab
52
54
 
53
55
  def execute!(&block)
54
56
  Docker::Shellout.new(self).execute!(&block)
57
+ rescue Docker::Shellout::StatusError => e
58
+ e.set_backtrace([])
59
+
60
+ raise e
55
61
  end
56
62
 
57
63
  def self.execute(cmd, mask_secrets: nil, &block)
@@ -142,6 +142,16 @@ module Gitlab
142
142
  Docker::Command.execute(['ps', name].compact.join(' '))
143
143
  end
144
144
 
145
+ def inspect(name)
146
+ Docker::Command.new('inspect').then do |command|
147
+ yield command if block_given?
148
+
149
+ command << name
150
+
151
+ command.execute!
152
+ end
153
+ end
154
+
145
155
  private
146
156
 
147
157
  def full_image_name(image, tag)