gitlab-qa 11.3.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.gitlab-ci.yml +3 -1
- data/.rubocop.yml +13 -2
- data/.rubocop_todo.yml +57 -85
- data/Gemfile.lock +44 -36
- data/docs/running_against_remote_grid.md +7 -5
- data/gitlab-qa.gemspec +4 -2
- data/lib/gitlab/qa/component/base.rb +9 -9
- data/lib/gitlab/qa/component/gitaly.rb +2 -2
- data/lib/gitlab/qa/component/gitaly_cluster.rb +14 -8
- data/lib/gitlab/qa/component/gitlab.rb +34 -14
- data/lib/gitlab/qa/component/mail_hog.rb +1 -0
- data/lib/gitlab/qa/component/praefect.rb +2 -2
- data/lib/gitlab/qa/component/selenoid.rb +6 -4
- data/lib/gitlab/qa/component/specs.rb +5 -2
- data/lib/gitlab/qa/component/staging.rb +4 -4
- data/lib/gitlab/qa/component/telegraf.rb +2 -1
- data/lib/gitlab/qa/docker/engine.rb +6 -3
- data/lib/gitlab/qa/docker/volumes.rb +1 -1
- data/lib/gitlab/qa/release.rb +4 -4
- data/lib/gitlab/qa/runner.rb +10 -3
- data/lib/gitlab/qa/runtime/env.rb +21 -19
- data/lib/gitlab/qa/runtime/logger.rb +1 -1
- data/lib/gitlab/qa/runtime/omnibus_configuration.rb +1 -0
- data/lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb +2 -1
- data/lib/gitlab/qa/runtime/scenario.rb +1 -5
- data/lib/gitlab/qa/scenario/actable.rb +4 -4
- data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +2 -2
- data/lib/gitlab/qa/scenario/test/instance/deployment_base.rb +2 -1
- data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ldap.rb +5 -6
- data/lib/gitlab/qa/scenario/test/integration/oauth.rb +13 -4
- data/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb +1 -1
- data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +1 -3
- data/lib/gitlab/qa/scenario/test/sanity/version.rb +1 -1
- data/lib/gitlab/qa/support/config_scripts.rb +1 -1
- data/lib/gitlab/qa/support/gitlab_version_info.rb +3 -5
- data/lib/gitlab/qa/support/shell_command.rb +1 -0
- data/lib/gitlab/qa/test_logger.rb +2 -2
- data/lib/gitlab/qa/version.rb +1 -1
- data/support/data/admin_access_token_seed.rb +1 -0
- data/support/data/license_usage_seed.rb +3 -1
- metadata +13 -8
- data/lib/gitlab/qa/runtime/omnibus_configurations/packages.rb +0 -17
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# rubocop:disable Metrics/AbcSize
|
3
4
|
|
4
5
|
require 'securerandom'
|
@@ -17,19 +18,19 @@ module Gitlab
|
|
17
18
|
using Rainbow
|
18
19
|
|
19
20
|
attr_reader :release,
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
:omnibus_configuration,
|
22
|
+
:omnibus_gitlab_rails_env,
|
23
|
+
:authority_volume,
|
24
|
+
:ssl_volume
|
24
25
|
|
25
26
|
attr_accessor :tls,
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
:skip_availability_check,
|
28
|
+
:runner_network,
|
29
|
+
:seed_admin_token,
|
30
|
+
:seed_db,
|
31
|
+
:skip_server_hooks,
|
32
|
+
:gitaly_tls,
|
33
|
+
:secrets
|
33
34
|
|
34
35
|
attr_writer :name, :relative_path
|
35
36
|
|
@@ -182,9 +183,9 @@ module Gitlab
|
|
182
183
|
def reconfigure
|
183
184
|
setup_omnibus
|
184
185
|
|
185
|
-
@docker.attach(name) do |line,
|
186
|
+
@docker.attach(name) do |line, _wait|
|
186
187
|
# TODO, workaround which allows to detach from the container
|
187
|
-
break if
|
188
|
+
break if line.include?('gitlab Reconfigured!')
|
188
189
|
end
|
189
190
|
end
|
190
191
|
|
@@ -252,7 +253,13 @@ module Gitlab
|
|
252
253
|
end
|
253
254
|
|
254
255
|
def delete_key_file(path)
|
255
|
-
|
256
|
+
FileUtils.rm_f(path)
|
257
|
+
end
|
258
|
+
|
259
|
+
def teardown!
|
260
|
+
log_pg_stats
|
261
|
+
|
262
|
+
super
|
256
263
|
end
|
257
264
|
|
258
265
|
private
|
@@ -307,6 +314,19 @@ module Gitlab
|
|
307
314
|
["gitlab-rails runner #{DATA_PATH}/admin_access_token_seed.rb"]
|
308
315
|
end
|
309
316
|
|
317
|
+
def log_pg_stats
|
318
|
+
Runtime::Logger.debug('Fetching pg statistics')
|
319
|
+
File.open("#{Runtime::Env.host_artifacts_dir}/pg_stats.log", 'a') do |file|
|
320
|
+
file << "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} -- #{name} -- Postgres statistics after test run:\n"
|
321
|
+
file << "Live and dead row counts:\n"
|
322
|
+
file << @docker.exec(name, %(gitlab-psql -c 'select n_live_tup, n_dead_tup, relname from pg_stat_all_tables order by n_live_tup DESC, n_dead_tup DESC;'))
|
323
|
+
file << "Cumulative user table statistics:\n"
|
324
|
+
file << @docker.exec(name, %(gitlab-psql -c 'select * from pg_stat_user_tables;'))
|
325
|
+
end
|
326
|
+
rescue StandardError => e
|
327
|
+
Runtime::Logger.error("Error getting pg statistics: #{e}")
|
328
|
+
end
|
329
|
+
|
310
330
|
class Availability
|
311
331
|
def initialize(name, relative_path: '', scheme: 'http', protocol_port: 80)
|
312
332
|
@docker = Docker::Engine.new
|
@@ -37,7 +37,7 @@ module Gitlab
|
|
37
37
|
setup_omnibus
|
38
38
|
@docker.attach(name) do |line|
|
39
39
|
# TODO, workaround which allows to detach from the container
|
40
|
-
break if
|
40
|
+
break if line.include?('gitlab Reconfigured!')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -50,7 +50,7 @@ module Gitlab
|
|
50
50
|
def wait_until_ready
|
51
51
|
@docker.exec(name, 'praefect -config /var/opt/gitlab/praefect/cluster_config.toml check || true') do |resp|
|
52
52
|
Runtime::Logger.info(resp)
|
53
|
-
break if
|
53
|
+
break if line.include?('All checks passed')
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -29,10 +29,12 @@ module Gitlab
|
|
29
29
|
pull_images
|
30
30
|
docker.run(image: image, tag: tag, args:
|
31
31
|
['-video-recorder-image',
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
QA::Runtime::Env.video_recorder_image,
|
33
|
+
'-container-network',
|
34
|
+
network,
|
35
|
+
'-timeout',
|
36
|
+
'10m0s']
|
37
|
+
) do |command|
|
36
38
|
set_command_args(command)
|
37
39
|
set_volumes(command)
|
38
40
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# rubocop:disable Metrics/CyclomaticComplexity
|
3
4
|
# rubocop:disable Metrics/AbcSize
|
4
5
|
|
@@ -56,8 +57,10 @@ module Gitlab
|
|
56
57
|
|
57
58
|
feature_flag_sets = []
|
58
59
|
|
59
|
-
# When `args` includes
|
60
|
-
#
|
60
|
+
# When `args` includes:
|
61
|
+
# `[..., "--disable-feature", "a", "--enable-feature", "b", "--set-feature-flags", "c=enable", ...]`
|
62
|
+
# `feature_flag_sets` will be set to:
|
63
|
+
# `[["--disable-feature", "a"], ["--enable-feature", "b"], ["--set-feature-flags", "c=enable"]]`
|
61
64
|
# This will result in tests running three times, once with each feature flag option.
|
62
65
|
while (index = args&.index { |x| x =~ /--.*-feature/ })
|
63
66
|
feature_flag_sets << args.slice!(index, 2)
|
@@ -13,9 +13,9 @@ module Gitlab
|
|
13
13
|
|
14
14
|
def self.release
|
15
15
|
QA::Release.new(image)
|
16
|
-
rescue Support::InvalidResponseError =>
|
17
|
-
warn
|
18
|
-
warn "#{
|
16
|
+
rescue Support::InvalidResponseError => e
|
17
|
+
warn e.message
|
18
|
+
warn "#{e.response.code} #{e.response.message}: #{e.response.body}"
|
19
19
|
exit 1
|
20
20
|
end
|
21
21
|
|
@@ -81,7 +81,7 @@ module Gitlab
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def api_get!
|
84
|
-
@response_body ||=
|
84
|
+
@response_body ||=
|
85
85
|
begin
|
86
86
|
response = Support::GetRequest.new(uri, Runtime::Env.qa_access_token).execute!
|
87
87
|
JSON.parse(response.body)
|
@@ -43,7 +43,8 @@ module Gitlab
|
|
43
43
|
#
|
44
44
|
# @return [void]
|
45
45
|
def prepare
|
46
|
-
@telegraf_config = File.open("#{Dir.mktmpdir(nil, ENV
|
46
|
+
@telegraf_config = File.open("#{Dir.mktmpdir(nil, ENV.fetch('CI_BUILDS_DIR', nil))}/telegraf.conf",
|
47
|
+
'w') do |file|
|
47
48
|
file.write(config)
|
48
49
|
file.path
|
49
50
|
end
|
@@ -18,7 +18,8 @@ module Gitlab
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def login(username:, password:, registry:)
|
21
|
-
Docker::Command.execute(%(login --username "#{username}" --password "#{password}" #{registry}),
|
21
|
+
Docker::Command.execute(%(login --username "#{username}" --password "#{password}" #{registry}),
|
22
|
+
mask_secrets: password)
|
22
23
|
end
|
23
24
|
|
24
25
|
def pull(image:, tag: nil, quiet: true)
|
@@ -63,7 +64,8 @@ module Gitlab
|
|
63
64
|
Class.new do
|
64
65
|
# @param file The name of the file
|
65
66
|
# @param contents The content of the file to write
|
66
|
-
# @param expand_vars Set false if you need to write an environment variable '$' to a file.
|
67
|
+
# @param expand_vars Set false if you need to write an environment variable '$' to a file.
|
68
|
+
# The variable should be escaped \\\$
|
67
69
|
def self.write(file, contents, expand_vars = true)
|
68
70
|
if expand_vars
|
69
71
|
%(echo "#{contents}" > #{file};)
|
@@ -82,7 +84,8 @@ module Gitlab
|
|
82
84
|
def exec(name, command, mask_secrets: nil)
|
83
85
|
cmd = ['exec']
|
84
86
|
cmd << '--privileged' if privileged_command?(command)
|
85
|
-
Docker::Command.execute(%(#{cmd.join(' ')} #{name} bash -c "#{command.gsub('"', '\\"')}"),
|
87
|
+
Docker::Command.execute(%(#{cmd.join(' ')} #{name} bash -c "#{command.gsub('"', '\\"')}"),
|
88
|
+
mask_secrets: mask_secrets)
|
86
89
|
end
|
87
90
|
|
88
91
|
def read_file(image, tag, path, &block)
|
@@ -20,7 +20,7 @@ module Gitlab
|
|
20
20
|
# but Docker on macOS exposes /private and disallow exposing /var/
|
21
21
|
# so we need to get the real tmpdir path
|
22
22
|
Dir.mktmpdir('gitlab-qa-', File.realpath(Dir.tmpdir)).tap do |dir|
|
23
|
-
yield
|
23
|
+
yield @volumes.transform_keys { |k| "#{dir}/#{k}" }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/gitlab/qa/release.rb
CHANGED
@@ -11,7 +11,7 @@ module Gitlab
|
|
11
11
|
(-qa)?
|
12
12
|
(:(?<tag>.+))?
|
13
13
|
\z
|
14
|
-
/xi
|
14
|
+
/xi
|
15
15
|
CUSTOM_GITLAB_IMAGE_REGEX = %r{
|
16
16
|
\A
|
17
17
|
(?<image_without_tag>
|
@@ -23,7 +23,7 @@ module Gitlab
|
|
23
23
|
(-qa)?
|
24
24
|
(:(?<tag>.+))?
|
25
25
|
\z
|
26
|
-
}xi
|
26
|
+
}xi
|
27
27
|
|
28
28
|
delegate :ci_project_path, to: Gitlab::QA::Runtime::Env
|
29
29
|
|
@@ -39,7 +39,7 @@ module Gitlab
|
|
39
39
|
\A
|
40
40
|
(?<version>\d+\.\d+.\d+(?:-rc\d+)?)-(?<edition>ce|ee|jh)
|
41
41
|
\z
|
42
|
-
/xi
|
42
|
+
/xi
|
43
43
|
|
44
44
|
# Dev tag example:
|
45
45
|
# 12.1.201906121026-325a6632895.b340d0bd35d
|
@@ -53,7 +53,7 @@ module Gitlab
|
|
53
53
|
\A
|
54
54
|
(?<version>\d+\.\d+(.\d+)?)\.(?<timestamp>\d+)-(?<gitlab_ref>[A-Za-z0-9]+)\.(?<omnibus_ref>[A-Za-z0-9]+)
|
55
55
|
\z
|
56
|
-
/xi
|
56
|
+
/xi
|
57
57
|
|
58
58
|
DEFAULT_TAG = 'latest'
|
59
59
|
DEFAULT_CANONICAL_TAG = 'nightly'
|
data/lib/gitlab/qa/runner.rb
CHANGED
@@ -29,7 +29,8 @@ module Gitlab
|
|
29
29
|
Runtime::Scenario.define(:teardown, false)
|
30
30
|
end
|
31
31
|
|
32
|
-
opts.on('--no-tests',
|
32
|
+
opts.on('--no-tests',
|
33
|
+
'Orchestrates the docker containers but does not run the tests. Implies --no-teardown') do
|
33
34
|
Runtime::Scenario.define(:run_tests, false)
|
34
35
|
Runtime::Scenario.define(:teardown, false)
|
35
36
|
end
|
@@ -42,7 +43,12 @@ module Gitlab
|
|
42
43
|
Runtime::Scenario.define(:skip_server_hooks, true)
|
43
44
|
end
|
44
45
|
|
45
|
-
opts.on(
|
46
|
+
opts.on(
|
47
|
+
'--qa-image QA_IMAGE',
|
48
|
+
String,
|
49
|
+
"Specifies a QA image to be used instead of inferring it from the GitLab image." \
|
50
|
+
"See Gitlab::QA::Release#qa_image"
|
51
|
+
) do |value|
|
46
52
|
Runtime::Scenario.define(:qa_image, value)
|
47
53
|
end
|
48
54
|
|
@@ -58,7 +64,8 @@ module Gitlab
|
|
58
64
|
end
|
59
65
|
end
|
60
66
|
|
61
|
-
opts.on('--seed-db search_pattern1[,search_pattern2,...]',
|
67
|
+
opts.on('--seed-db search_pattern1[,search_pattern2,...]',
|
68
|
+
'Seed application database with sample test data') do |file_pattern|
|
62
69
|
file_pattern.split(',').each do |pattern|
|
63
70
|
@seed_scripts << pattern
|
64
71
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support'
|
3
4
|
require 'active_support/core_ext/object/blank'
|
4
5
|
require 'securerandom'
|
5
6
|
|
@@ -78,6 +79,8 @@ module Gitlab
|
|
78
79
|
'GITLAB_QA_PASSWORD_2' => :gitlab_qa_password_2,
|
79
80
|
'QA_GITHUB_USERNAME' => :qa_github_username,
|
80
81
|
'QA_GITHUB_PASSWORD' => :qa_github_password,
|
82
|
+
'QA_FACEBOOK_USERNAME' => :qa_facebook_username,
|
83
|
+
'QA_FACEBOOK_PASSWORD' => :qa_facebook_password,
|
81
84
|
'KNAPSACK_GENERATE_REPORT' => :knapsack_generate_report,
|
82
85
|
'KNAPSACK_REPORT_PATH' => :knapsack_report_path,
|
83
86
|
'KNAPSACK_TEST_FILE_PATTERN' => :knapsack_test_file_pattern,
|
@@ -140,6 +143,8 @@ module Gitlab
|
|
140
143
|
'JH_ENV' => :jh_env,
|
141
144
|
'QA_GITHUB_OAUTH_APP_ID' => :github_oauth_app_id,
|
142
145
|
'QA_GITHUB_OAUTH_APP_SECRET' => :github_oauth_app_secret,
|
146
|
+
'QA_FACEBOOK_OAUTH_APP_ID' => :facebook_oauth_app_id,
|
147
|
+
'QA_FACEBOOK_OAUTH_APP_SECRET' => :facebook_oauth_app_secret,
|
143
148
|
'QA_1P_EMAIL' => :qa_1p_email,
|
144
149
|
'QA_1P_PASSWORD' => :qa_1p_password,
|
145
150
|
'QA_1P_SECRET' => :qa_1p_secret,
|
@@ -157,9 +162,7 @@ module Gitlab
|
|
157
162
|
attr_writer(method_name)
|
158
163
|
|
159
164
|
define_method(method_name) do
|
160
|
-
env_var_value_if_defined(env_name) || (if instance_variable_defined?("@#{method_name}")
|
161
|
-
instance_variable_get("@#{method_name}")
|
162
|
-
end)
|
165
|
+
env_var_value_if_defined(env_name) || (instance_variable_get("@#{method_name}") if instance_variable_defined?("@#{method_name}"))
|
163
166
|
end
|
164
167
|
end
|
165
168
|
|
@@ -170,7 +173,7 @@ module Gitlab
|
|
170
173
|
value = env_var_name_if_defined(name) || send(attribute) # rubocop:disable GitlabSecurity/PublicSend
|
171
174
|
vars[name] = value if value
|
172
175
|
end
|
173
|
-
qa_variables = ENV.each_with_object({}) do |(name,
|
176
|
+
qa_variables = ENV.each_with_object({}) do |(name, _value), vars|
|
174
177
|
next unless name.start_with?('QA_')
|
175
178
|
|
176
179
|
var_name = env_var_name_if_defined(name)
|
@@ -181,7 +184,7 @@ module Gitlab
|
|
181
184
|
end
|
182
185
|
|
183
186
|
def debug?
|
184
|
-
enabled?(ENV
|
187
|
+
enabled?(ENV.fetch('QA_DEBUG', nil), default: true)
|
185
188
|
end
|
186
189
|
|
187
190
|
def log_level
|
@@ -209,7 +212,7 @@ module Gitlab
|
|
209
212
|
end
|
210
213
|
|
211
214
|
def colorized_logs?
|
212
|
-
enabled?(ENV
|
215
|
+
enabled?(ENV.fetch('COLORIZED_LOGS', nil), default: false)
|
213
216
|
end
|
214
217
|
|
215
218
|
def dev_access_token_variable
|
@@ -266,32 +269,31 @@ module Gitlab
|
|
266
269
|
|
267
270
|
def require_aws_s3_environment!
|
268
271
|
%w[AWS_S3_REGION AWS_S3_KEY_ID AWS_S3_ACCESS_KEY AWS_S3_BUCKET_NAME].each do |env_key|
|
269
|
-
unless ENV.key?(env_key)
|
270
|
-
raise ArgumentError, "Environment variable #{env_key} must be set to run AWS S3 object storage specs"
|
271
|
-
end
|
272
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run AWS S3 object storage specs" unless ENV.key?(env_key)
|
272
273
|
end
|
273
274
|
end
|
274
275
|
|
275
276
|
def require_gcs_environment!
|
276
277
|
%w[GOOGLE_PROJECT GOOGLE_CLIENT_EMAIL GOOGLE_JSON_KEY GCS_BUCKET_NAME].each do |env_key|
|
277
|
-
unless ENV.key?(env_key)
|
278
|
-
raise ArgumentError, "Environment variable #{env_key} must be set to run GCS object storage specs"
|
279
|
-
end
|
278
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run GCS object storage specs" unless ENV.key?(env_key)
|
280
279
|
end
|
281
280
|
end
|
282
281
|
|
283
282
|
def require_gcs_with_cdn_environment!
|
284
|
-
%w[GOOGLE_CDN_JSON_KEY GCS_CDN_BUCKET_NAME GOOGLE_CDN_LB GOOGLE_CDN_SIGNURL_KEY
|
285
|
-
|
286
|
-
|
287
|
-
end
|
283
|
+
%w[GOOGLE_CDN_JSON_KEY GCS_CDN_BUCKET_NAME GOOGLE_CDN_LB GOOGLE_CDN_SIGNURL_KEY
|
284
|
+
GOOGLE_CDN_SIGNURL_KEY_NAME].each do |env_key|
|
285
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run GCS with CDN enabled scenario" unless ENV.key?(env_key)
|
288
286
|
end
|
289
287
|
end
|
290
288
|
|
291
289
|
def require_oauth_environment!
|
292
290
|
%w[QA_GITHUB_OAUTH_APP_ID QA_GITHUB_OAUTH_APP_SECRET QA_GITHUB_USERNAME
|
293
|
-
|
294
|
-
|
291
|
+
QA_GITHUB_PASSWORD QA_1P_EMAIL QA_1P_PASSWORD QA_1P_SECRET QA_1P_GITHUB_UUID QA_FACEBOOK_USERNAME
|
292
|
+
QA_FACEBOOK_PASSWORD QA_FACEBOOK_OAUTH_APP_SECRET QA_FACEBOOK_OAUTH_APP_ID].each do |env_key|
|
293
|
+
unless ENV.key?(env_key)
|
294
|
+
raise ArgumentError,
|
295
|
+
"Environment variable #{env_key} must be set to run OAuth specs"
|
296
|
+
end
|
295
297
|
end
|
296
298
|
end
|
297
299
|
|
@@ -441,7 +443,7 @@ module Gitlab
|
|
441
443
|
end
|
442
444
|
|
443
445
|
def env_var_value_if_defined(variable)
|
444
|
-
return ENV
|
446
|
+
return ENV.fetch(variable, nil) if env_var_value_valid?(variable)
|
445
447
|
end
|
446
448
|
|
447
449
|
def env_var_name_if_defined(variable)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'tempfile'
|
3
4
|
|
4
5
|
module Gitlab
|
@@ -26,7 +27,7 @@ module Gitlab
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def setup_json_key
|
29
|
-
Tempfile.open('gcs-json-key', ENV
|
30
|
+
Tempfile.open('gcs-json-key', ENV.fetch('CI_PROJECT_DIR', nil)) do |file|
|
30
31
|
file.write(ENV.fetch('GOOGLE_JSON_KEY'))
|
31
32
|
|
32
33
|
file
|
@@ -18,18 +18,14 @@ module Gitlab
|
|
18
18
|
|
19
19
|
define_singleton_method(attribute) do
|
20
20
|
attributes[attribute.to_sym].tap do |value|
|
21
|
-
if value.to_s.empty?
|
22
|
-
raise ArgumentError, "Empty `#{attribute}` attribute!"
|
23
|
-
end
|
21
|
+
raise ArgumentError, "Empty `#{attribute}` attribute!" if value.to_s.empty?
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
|
-
# rubocop:disable Style/MethodMissing
|
29
26
|
def method_missing(name, *)
|
30
27
|
raise ArgumentError, "Scenario attribute `#{name}` not defined!"
|
31
28
|
end
|
32
|
-
# rubocop:enable Style/MethodMissing
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
@@ -4,8 +4,8 @@ module Gitlab
|
|
4
4
|
module QA
|
5
5
|
module Scenario
|
6
6
|
module Actable
|
7
|
-
def act(
|
8
|
-
instance_exec(
|
7
|
+
def act(...)
|
8
|
+
instance_exec(...)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.included(base)
|
@@ -17,8 +17,8 @@ module Gitlab
|
|
17
17
|
yield new if block_given?
|
18
18
|
end
|
19
19
|
|
20
|
-
def act(
|
21
|
-
new.act(
|
20
|
+
def act(...)
|
21
|
+
new.act(...)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -80,10 +80,10 @@ module Gitlab
|
|
80
80
|
iptables -A OUTPUT -p tcp -m tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
|
81
81
|
iptables -A INPUT -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
|
82
82
|
|
83
|
-
# some exceptions to allow runners access network https://gitlab.com/gitlab-org/gitlab-qa/-/issues/700
|
83
|
+
# some exceptions to allow runners access network https://gitlab.com/gitlab-org/gitlab-qa/-/issues/700#{' '}
|
84
84
|
iptables -A OUTPUT -p tcp -d #{gitlab_registry_ip} -j ACCEPT
|
85
85
|
iptables -A OUTPUT -p tcp -d #{dev_gitlab_registry_ip} -j ACCEPT
|
86
|
-
# allow access to praefect node
|
86
|
+
# allow access to praefect node#{' '}
|
87
87
|
iptables -A OUTPUT -p tcp -d #{praefect_ip} -j ACCEPT
|
88
88
|
|
89
89
|
# Should now fail to ping gitlab_ip, port 22/80 should be open
|
@@ -37,7 +37,8 @@ module Gitlab
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def deployment_component
|
40
|
-
raise NotImplementedError,
|
40
|
+
raise NotImplementedError,
|
41
|
+
'Please define the Component for the deployment environment associated with this scenario.'
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
@@ -18,7 +18,7 @@ module Gitlab
|
|
18
18
|
raise ArgumentError, 'Group SAML is EE only feature!' unless release.ee?
|
19
19
|
end
|
20
20
|
|
21
|
-
def configure(gitlab,
|
21
|
+
def configure(gitlab, _saml)
|
22
22
|
gitlab.omnibus_configuration << <<~OMNIBUS
|
23
23
|
gitlab_rails['omniauth_enabled'] = true;
|
24
24
|
gitlab_rails['omniauth_providers'] = [{ name: 'group_saml' }];
|
@@ -66,16 +66,14 @@ module Gitlab
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def orchestrate_ldap
|
69
|
+
def orchestrate_ldap(&block)
|
70
70
|
Component::LDAP.perform do |ldap|
|
71
71
|
ldap.name = 'ldap-server'
|
72
72
|
ldap.network = 'test'
|
73
73
|
ldap.set_gitlab_credentials
|
74
74
|
ldap.tls = tls
|
75
75
|
|
76
|
-
ldap.instance
|
77
|
-
yield
|
78
|
-
end
|
76
|
+
ldap.instance(&block)
|
79
77
|
end
|
80
78
|
end
|
81
79
|
|
@@ -90,8 +88,9 @@ module Gitlab
|
|
90
88
|
if orchestrate_ldap_server
|
91
89
|
orchestrate_ldap { run_specs(gitlab, {}, *rspec_args) }
|
92
90
|
else
|
93
|
-
volumes = {
|
94
|
-
|
91
|
+
volumes = { admin: File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'qa/fixtures/ldap/admin'),
|
92
|
+
non_admin: File.join(Docker::Volumes::QA_CONTAINER_WORKDIR,
|
93
|
+
'qa/fixtures/ldap/non_admin') }
|
95
94
|
run_specs(gitlab, volumes, *rspec_args)
|
96
95
|
end
|
97
96
|
end
|
@@ -11,7 +11,7 @@ module Gitlab
|
|
11
11
|
attr_reader :gitlab_name
|
12
12
|
|
13
13
|
def initialize
|
14
|
-
@gitlab_name = 'gitlab
|
14
|
+
@gitlab_name = 'gitlab'
|
15
15
|
end
|
16
16
|
|
17
17
|
def perform(release, *rspec_args)
|
@@ -23,8 +23,9 @@ module Gitlab
|
|
23
23
|
gitlab.release = release
|
24
24
|
gitlab.network = 'test'
|
25
25
|
gitlab.name = gitlab_name
|
26
|
+
gitlab.tls = true
|
26
27
|
|
27
|
-
gitlab.omnibus_configuration << gitlab_omnibus_configuration
|
28
|
+
gitlab.omnibus_configuration << gitlab_omnibus_configuration(gitlab.address)
|
28
29
|
|
29
30
|
gitlab.instance do
|
30
31
|
Runtime::Logger.info('Running OAuth specs!')
|
@@ -43,10 +44,10 @@ module Gitlab
|
|
43
44
|
|
44
45
|
private
|
45
46
|
|
46
|
-
def gitlab_omnibus_configuration
|
47
|
+
def gitlab_omnibus_configuration(gitlab_address)
|
47
48
|
<<~OMNIBUS
|
48
49
|
gitlab_rails['omniauth_enabled'] = true;
|
49
|
-
gitlab_rails['omniauth_allow_single_sign_on'] = ['github'];
|
50
|
+
gitlab_rails['omniauth_allow_single_sign_on'] = ['github', 'facebook'];
|
50
51
|
gitlab_rails['omniauth_block_auto_created_users'] = false;
|
51
52
|
gitlab_rails['omniauth_providers'] = [
|
52
53
|
{
|
@@ -56,8 +57,16 @@ module Gitlab
|
|
56
57
|
url: 'https://github.com/',
|
57
58
|
verify_ssl: false,
|
58
59
|
args: { scope: 'user:email' }
|
60
|
+
},
|
61
|
+
{
|
62
|
+
name: 'facebook',
|
63
|
+
app_id: '$QA_FACEBOOK_OAUTH_APP_ID',
|
64
|
+
app_secret: '$QA_FACEBOOK_OAUTH_APP_SECRET',
|
65
|
+
verify_ssl: false
|
59
66
|
}
|
60
67
|
];
|
68
|
+
letsencrypt['enable'] = false;
|
69
|
+
external_url '#{gitlab_address}';
|
61
70
|
OMNIBUS
|
62
71
|
end
|
63
72
|
end
|
@@ -115,7 +115,7 @@ module Gitlab
|
|
115
115
|
# @param [Gitlab::QA::Release] release
|
116
116
|
# @return [Boolean]
|
117
117
|
def run_specs?(release)
|
118
|
-
[upgrade_path.first, current_release].any?
|
118
|
+
[upgrade_path.first, current_release].any?(release)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -12,9 +12,7 @@ module Gitlab
|
|
12
12
|
def perform(image = 'CE', *rspec_args)
|
13
13
|
ce_release = QA::Release.new(image)
|
14
14
|
|
15
|
-
if ce_release.ee?
|
16
|
-
raise ArgumentError, 'Only CE can be upgraded to EE!'
|
17
|
-
end
|
15
|
+
raise ArgumentError, 'Only CE can be upgraded to EE!' if ce_release.ee?
|
18
16
|
|
19
17
|
Docker::Volumes.new.with_temporary_volumes do |volumes|
|
20
18
|
Scenario::Test::Instance::Image
|
@@ -71,7 +71,7 @@ module Gitlab
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def commit_within_hours?(commit_time_string, hours)
|
74
|
-
Time.at(Time.parse(commit_time_string).utc).to_datetime > Time.at((Time.now - hours * 60 * 60).utc).to_datetime
|
74
|
+
Time.at(Time.parse(commit_time_string).utc).to_datetime > Time.at((Time.now - (hours * 60 * 60)).utc).to_datetime
|
75
75
|
end
|
76
76
|
|
77
77
|
def api_commit_detail(host, project, sha)
|
@@ -10,7 +10,7 @@ module Gitlab
|
|
10
10
|
global_server_prereceive_hook = <<~SCRIPT
|
11
11
|
#!/usr/bin/env bash
|
12
12
|
|
13
|
-
if [[
|
13
|
+
if [[ \\$GL_PROJECT_PATH =~ 'reject-prereceive' ]]; then
|
14
14
|
echo 'GL-HOOK-ERR: Custom error message rejecting prereceive hook for projects with GL_PROJECT_PATH matching pattern reject-prereceive'
|
15
15
|
exit 1
|
16
16
|
fi
|