gitlab-qa 7.16.1 → 7.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +40 -21
- data/docs/what_tests_can_be_run.md +5 -0
- data/gitlab-qa.gemspec +2 -1
- data/lib/gitlab/qa/component/base.rb +1 -1
- data/lib/gitlab/qa/component/minio.rb +1 -1
- data/lib/gitlab/qa/component/specs.rb +9 -4
- data/lib/gitlab/qa/docker/shellout.rb +5 -2
- data/lib/gitlab/qa/report/report_results.rb +4 -15
- data/lib/gitlab/qa/runtime/env.rb +46 -24
- data/lib/gitlab/qa/runtime/logger.rb +36 -0
- data/lib/gitlab/qa/scenario/test/instance/image.rb +1 -0
- data/lib/gitlab/qa/scenario/test/integration/actioncable.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/client_ssl.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/cloud_activation.rb +36 -0
- data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/geo.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/jira.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ldap.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/mtls.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/saml.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/smtp.rb +1 -1
- data/lib/gitlab/qa/support/get_request.rb +1 -1
- data/lib/gitlab/qa/version.rb +3 -1
- data/lib/gitlab/qa.rb +2 -0
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b05f451b8f3fef95132c1392719b6e20d777c495778df260ca340af2db4dc21
|
4
|
+
data.tar.gz: ebea6af07ab05c224982347a5d71c2ccfd31e0eaede1fa40a27c2fae65bc3da8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2724c38eb788f497af697dd743618ed13b45873e9b9da8937943489146a517cb6d067bf7d8354d77f4349fa8b19b35118e99919eba4ff43b39f8e2de24668035
|
7
|
+
data.tar.gz: b93d8f4055d6a9b6d897202da7f413a181293fc25b49aa30709976fd4d1da0e86bc2e4976f73b738f539de1a0e6438247bd8df814c7d853a05eb18d1c0243812
|
data/.gitlab-ci.yml
CHANGED
@@ -77,7 +77,7 @@ rspec:
|
|
77
77
|
when: always
|
78
78
|
expire_in: 10d
|
79
79
|
paths:
|
80
|
-
-
|
80
|
+
- gitlab-qa-run-*
|
81
81
|
reports:
|
82
82
|
junit: gitlab-qa-run-*/**/rspec-*.xml
|
83
83
|
script:
|
@@ -125,12 +125,6 @@ rspec:
|
|
125
125
|
- 7gb
|
126
126
|
- triggered-packages
|
127
127
|
|
128
|
-
.knapsack-variables:
|
129
|
-
variables:
|
130
|
-
KNAPSACK_REPORT_PATH: "knapsack/master_report.json"
|
131
|
-
KNAPSACK_TEST_FILE_PATTERN: "qa/specs/features/**/*_spec.rb"
|
132
|
-
KNAPSACK_GENERATE_REPORT: "true"
|
133
|
-
|
134
128
|
.rspec-report-opts:
|
135
129
|
variables:
|
136
130
|
FILE_SAFE_JOB_NAME: $(echo $CI_JOB_NAME | sed 's/[ /]/_/g')
|
@@ -174,7 +168,6 @@ ce:custom-parallel:
|
|
174
168
|
- .rspec-report-opts
|
175
169
|
- .no-issue-report-script
|
176
170
|
- .ce-variables
|
177
|
-
|
178
171
|
allow_failure: true
|
179
172
|
parallel: 10
|
180
173
|
|
@@ -195,7 +188,6 @@ ce:instance-parallel:
|
|
195
188
|
- .test
|
196
189
|
- .high-capacity
|
197
190
|
- .ce-variables
|
198
|
-
- .knapsack-variables
|
199
191
|
- .rspec-report-opts
|
200
192
|
parallel: 5
|
201
193
|
|
@@ -224,7 +216,6 @@ ee:instance-parallel:
|
|
224
216
|
- .test
|
225
217
|
- .high-capacity
|
226
218
|
- .ee-variables
|
227
|
-
- .knapsack-variables
|
228
219
|
- .rspec-report-opts
|
229
220
|
parallel: 5
|
230
221
|
|
@@ -253,7 +244,6 @@ ce:relative_url-parallel:
|
|
253
244
|
- .test
|
254
245
|
- .high-capacity
|
255
246
|
- .ce-variables
|
256
|
-
- .knapsack-variables
|
257
247
|
- .rspec-report-opts
|
258
248
|
parallel: 5
|
259
249
|
variables:
|
@@ -287,7 +277,6 @@ ee:relative_url-parallel:
|
|
287
277
|
- .test
|
288
278
|
- .high-capacity
|
289
279
|
- .ee-variables
|
290
|
-
- .knapsack-variables
|
291
280
|
- .rspec-report-opts
|
292
281
|
parallel: 5
|
293
282
|
variables:
|
@@ -381,7 +370,6 @@ ce:update-parallel:
|
|
381
370
|
- .high-capacity
|
382
371
|
- .ce-variables
|
383
372
|
- .rspec-report-opts
|
384
|
-
- .knapsack-variables
|
385
373
|
- .update-scenario-script
|
386
374
|
parallel: 5
|
387
375
|
|
@@ -413,7 +401,6 @@ ee:update-parallel:
|
|
413
401
|
- .high-capacity
|
414
402
|
- .ee-variables
|
415
403
|
- .rspec-report-opts
|
416
|
-
- .knapsack-variables
|
417
404
|
- .update-scenario-script
|
418
405
|
parallel: 10
|
419
406
|
|
@@ -446,7 +433,6 @@ ce:upgrade-parallel:
|
|
446
433
|
- .test
|
447
434
|
- .high-capacity
|
448
435
|
- .rspec-report-opts
|
449
|
-
- .knapsack-variables
|
450
436
|
parallel: 5
|
451
437
|
|
452
438
|
ce:upgrade:
|
@@ -549,7 +535,7 @@ ee:service_ping_disabled:
|
|
549
535
|
variables:
|
550
536
|
QA_SCENARIO: "Test::Integration::ServicePingDisabled"
|
551
537
|
|
552
|
-
# Disabling geo jobs temporarily due to https://gitlab.com/gitlab-org/
|
538
|
+
# Disabling geo jobs temporarily due to https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/774
|
553
539
|
# ee:geo:
|
554
540
|
# extends:
|
555
541
|
# - .test
|
@@ -1011,7 +997,6 @@ ce:praefect-parallel:
|
|
1011
997
|
- .test
|
1012
998
|
- .high-capacity
|
1013
999
|
- .ce-variables
|
1014
|
-
- .knapsack-variables
|
1015
1000
|
- .rspec-report-opts
|
1016
1001
|
parallel: 5
|
1017
1002
|
variables:
|
@@ -1048,7 +1033,6 @@ ee:praefect-parallel:
|
|
1048
1033
|
- .test
|
1049
1034
|
- .high-capacity
|
1050
1035
|
- .ee-variables
|
1051
|
-
- .knapsack-variables
|
1052
1036
|
- .rspec-report-opts
|
1053
1037
|
parallel: 10
|
1054
1038
|
variables:
|
@@ -1225,6 +1209,35 @@ ee:large-setup:
|
|
1225
1209
|
variables:
|
1226
1210
|
QA_RSPEC_TAGS: "--tag can_use_large_setup"
|
1227
1211
|
|
1212
|
+
ee:cloud-activation:
|
1213
|
+
before_script:
|
1214
|
+
- unset EE_LICENSE
|
1215
|
+
- unset GITLAB_QA_FORMLESS_LOGIN_TOKEN
|
1216
|
+
- !reference [default, before_script]
|
1217
|
+
extends:
|
1218
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
1219
|
+
- .test
|
1220
|
+
- .high-capacity
|
1221
|
+
- .ee-variables
|
1222
|
+
- .rspec-report-opts
|
1223
|
+
variables:
|
1224
|
+
QA_SCENARIO: "Test::Integration::CloudActivation"
|
1225
|
+
|
1226
|
+
ee:cloud-activation-quarantine:
|
1227
|
+
before_script:
|
1228
|
+
- unset EE_LICENSE
|
1229
|
+
- unset GITLAB_QA_FORMLESS_LOGIN_TOKEN
|
1230
|
+
- !reference [default, before_script]
|
1231
|
+
extends:
|
1232
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
1233
|
+
- .test
|
1234
|
+
- .high-capacity
|
1235
|
+
- .ee-variables
|
1236
|
+
- .quarantine
|
1237
|
+
- .rspec-report-opts
|
1238
|
+
variables:
|
1239
|
+
QA_SCENARIO: "Test::Integration::CloudActivation"
|
1240
|
+
|
1228
1241
|
# This job requires the `GITLAB_QA_ACCESS_TOKEN` and `GITLAB_QA_DEV_ACCESS_TOKEN`
|
1229
1242
|
# variable to be passed when triggered.
|
1230
1243
|
staging:
|
@@ -1333,7 +1346,7 @@ generate-allure-report:
|
|
1333
1346
|
cache:
|
1334
1347
|
policy: pull
|
1335
1348
|
before_script:
|
1336
|
-
-
|
1349
|
+
- export ALLURE_JOB_NAME="${ALLURE_JOB_NAME:-package-and-qa}"
|
1337
1350
|
rules:
|
1338
1351
|
# Don't run report generation on release pipelines
|
1339
1352
|
- if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab-qa" && $RELEASE == null'
|
@@ -1346,13 +1359,19 @@ generate-allure-report:
|
|
1346
1359
|
ALLURE_JOB_NAME: gitlab-qa
|
1347
1360
|
when: always
|
1348
1361
|
- if: '$TOP_UPSTREAM_SOURCE_PROJECT && $TOP_UPSTREAM_SOURCE_SHA'
|
1349
|
-
variables:
|
1350
|
-
ALLURE_JOB_NAME: package-and-qa
|
1351
1362
|
when: always
|
1352
1363
|
|
1364
|
+
generate-knapsack-report:
|
1365
|
+
extends: .generate-knapsack-report-base
|
1366
|
+
image:
|
1367
|
+
name: ${QA_IMAGE}
|
1368
|
+
stage: report
|
1369
|
+
|
1353
1370
|
include:
|
1354
1371
|
- local: .gitlab/ci/*.gitlab-ci.yml
|
1355
1372
|
- project: 'gitlab-org/quality/pipeline-common'
|
1356
1373
|
file: '/ci/gem-release.yml'
|
1357
1374
|
- project: 'gitlab-org/quality/pipeline-common'
|
1358
1375
|
file: '/ci/allure-report.yml'
|
1376
|
+
- project: 'gitlab-org/quality/pipeline-common'
|
1377
|
+
file: '/ci/knapsack-report.yml'
|
@@ -59,6 +59,7 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
|
|
59
59
|
| `GITLAB_QA_ADMIN_ACCESS_TOKEN` |- | A valid personal access token with the `api` scope from a user with admin access. Used for API access as an admin during tests. | No|
|
60
60
|
| `GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN` | - | A valid personal access token with the `read_registry` scope. Used to [access the container registry on `registry.gitlab.com` when tests run in a CI job that _is not_ triggered via another pipeline](https://gitlab.com/gitlab-org/gitlab-qa/-/blob/364addb83e7b136ff0f9d8719ca9553d290aa9ab/lib/gitlab/qa/release.rb#L152). For example, if you manually run a [new Staging pipeline](https://ops.gitlab.net/gitlab-org/quality/staging/-/pipelines/new), this token will be used. | No |
|
61
61
|
| `EE_LICENSE` |- | Enterprise Edition license. | No|
|
62
|
+
| `QA_EE_ACTIVATION_CODE` |- | Cloud activation code to enable Enterprise Edition features. | No|
|
62
63
|
| `QA_ARTIFACTS_DIR` |`/tmp/gitlab-qa`| Path to a directory where artifacts (logs and screenshots) for failing tests will be saved. | No|
|
63
64
|
| `DOCKER_HOST` |`http://localhost`| Docker host to run tests against. | No|
|
64
65
|
| `WEBDRIVER_HEADLESS` |- | When running locally, set to `false` to allow Chrome tests to be visible - watch your tests being run. | No|
|
@@ -703,6 +704,9 @@ in the GitLab project).
|
|
703
704
|
|
704
705
|
**Required environment variables:**
|
705
706
|
|
707
|
+
- `GITLAB_QA_USER_AGENT`: The browser user-agent to use instead of the default Chrome user-agent.
|
708
|
+
This is needed for the automated tests to bypass the WAF
|
709
|
+
|
706
710
|
- `GITLAB_QA_ACCESS_TOKEN`: A valid personal access token with the `api` scope.
|
707
711
|
This is used to retrieve the version that staging is currently running.
|
708
712
|
This can be found in the shared 1Password vault.
|
@@ -718,6 +722,7 @@ in the GitLab project).
|
|
718
722
|
Example:
|
719
723
|
|
720
724
|
```
|
725
|
+
$ export GITLAB_QA_USER_AGENT="$GITLAB_QA_USER_AGENT"
|
721
726
|
$ export GITLAB_QA_ACCESS_TOKEN=your_api_access_token
|
722
727
|
$ export GITLAB_QA_DEV_ACCESS_TOKEN=your_dev_registry_access_token
|
723
728
|
$ export GITLAB_USERNAME="gitlab-qa"
|
data/gitlab-qa.gemspec
CHANGED
@@ -28,8 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'solargraph', '~> 0.41'
|
29
29
|
spec.add_development_dependency 'webmock', '3.7.0'
|
30
30
|
spec.add_runtime_dependency 'activesupport', '~> 6.1'
|
31
|
-
spec.add_runtime_dependency 'gitlab', '~> 4.
|
31
|
+
spec.add_runtime_dependency 'gitlab', '~> 4.18.0'
|
32
32
|
spec.add_runtime_dependency 'http', '~> 5.0'
|
33
33
|
spec.add_runtime_dependency 'nokogiri', '~> 1.10'
|
34
|
+
spec.add_runtime_dependency 'rainbow', '~> 3.0.0'
|
34
35
|
spec.add_runtime_dependency 'table_print', '1.5.7'
|
35
36
|
end
|
@@ -8,7 +8,7 @@ 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, :volumes, :env, :runner_network
|
11
|
+
attr_accessor :suite, :release, :network, :args, :volumes, :env, :runner_network, :hostname
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@docker = Docker::Engine.new
|
@@ -17,7 +17,7 @@ module Gitlab
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def perform
|
20
|
-
return
|
20
|
+
return Runtime::Logger.info("Skipping tests.") if skip_tests?
|
21
21
|
|
22
22
|
raise ArgumentError unless [suite, release].all?
|
23
23
|
|
@@ -25,7 +25,7 @@ module Gitlab
|
|
25
25
|
|
26
26
|
@docker.pull(image: qa_image) unless Runtime::Env.skip_pull?
|
27
27
|
|
28
|
-
|
28
|
+
Runtime::Logger.info("Running test suite `#{suite}` for #{release.project_name}")
|
29
29
|
|
30
30
|
name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}"
|
31
31
|
|
@@ -45,6 +45,11 @@ module Gitlab
|
|
45
45
|
@docker.run(image: qa_image, args: [suite, *args_with_flags(args, feature_flag_set)]) do |command|
|
46
46
|
command << "-t --rm --net=#{network || 'bridge'}"
|
47
47
|
|
48
|
+
unless hostname.nil?
|
49
|
+
command << "--hostname #{hostname}"
|
50
|
+
command.env('QA_HOSTNAME', hostname)
|
51
|
+
end
|
52
|
+
|
48
53
|
env.merge(Runtime::Env.variables).each do |key, value|
|
49
54
|
command.env(key, value)
|
50
55
|
end
|
@@ -66,7 +71,7 @@ module Gitlab
|
|
66
71
|
def args_with_flags(args, feature_flag_set)
|
67
72
|
return args if feature_flag_set.empty?
|
68
73
|
|
69
|
-
|
74
|
+
Runtime::Logger.info("Running with feature flag: #{feature_flag_set.join(' ')}")
|
70
75
|
|
71
76
|
args_with_f = args.dup
|
72
77
|
args_with_f.insert(1, *feature_flag_set)
|
@@ -1,16 +1,19 @@
|
|
1
1
|
require 'open3'
|
2
|
+
require 'rainbow/refinement'
|
2
3
|
|
3
4
|
module Gitlab
|
4
5
|
module QA
|
5
6
|
module Docker
|
6
7
|
class Shellout
|
8
|
+
using Rainbow
|
7
9
|
StatusError = Class.new(StandardError)
|
8
10
|
|
9
11
|
def initialize(command)
|
10
12
|
@command = command
|
11
13
|
@output = []
|
12
14
|
|
13
|
-
|
15
|
+
Rainbow.enabled = Runtime::Env.colorized_logs?
|
16
|
+
Runtime::Logger.info("Docker shell command: `#{@command.mask_secrets}`".cyan)
|
14
17
|
end
|
15
18
|
|
16
19
|
def execute! # rubocop:disable Metrics/AbcSize
|
@@ -28,7 +31,7 @@ module Gitlab
|
|
28
31
|
end
|
29
32
|
|
30
33
|
if wait.value.exited? && wait.value.exitstatus.nonzero? # rubocop:disable Style/IfUnlessModifier
|
31
|
-
raise StatusError, "Docker command `#{@command.mask_secrets}` failed!"
|
34
|
+
raise StatusError, "Docker command `#{@command.mask_secrets}` failed! ✘"
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
@@ -5,13 +5,10 @@ module Gitlab
|
|
5
5
|
module Report
|
6
6
|
# Uses the API to create or update GitLab test cases and issues with the results of tests from RSpec report files.
|
7
7
|
class ReportResults < ReportAsIssue
|
8
|
-
|
9
|
-
attr_accessor :testcase_project_reporter, :results_issue_project_reporter, :files, :test_case_project, :results_issue_project, :gitlab, :old_testcase_project_reporter
|
8
|
+
attr_accessor :testcase_project_reporter, :results_issue_project_reporter, :files, :test_case_project, :results_issue_project, :gitlab
|
10
9
|
|
11
10
|
def initialize(token:, input_files:, test_case_project:, results_issue_project:, dry_run: false, **kwargs)
|
12
11
|
@testcase_project_reporter = Gitlab::QA::Report::ResultsInTestCases.new(token: token, input_files: input_files, project: test_case_project, dry_run: dry_run, **kwargs)
|
13
|
-
# TODO: Remove the line below once all test case links are updated to the gitlab project. See https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1079
|
14
|
-
@old_testcase_project_reporter = Gitlab::QA::Report::ResultsInTestCases.new(token: token, input_files: input_files, project: results_issue_project, dry_run: dry_run, **kwargs)
|
15
12
|
@results_issue_project_reporter = Gitlab::QA::Report::ResultsInIssues.new(token: token, input_files: input_files, project: results_issue_project, dry_run: dry_run, **kwargs)
|
16
13
|
@test_case_project = test_case_project
|
17
14
|
@results_issue_project = results_issue_project
|
@@ -45,26 +42,18 @@ module Gitlab
|
|
45
42
|
private
|
46
43
|
|
47
44
|
def report_test(test)
|
48
|
-
|
49
|
-
# once all test case links are updated to the gitlab project. See https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1079
|
50
|
-
correct_testcase_project_reporter = using_old_testcase_link(test) ? old_testcase_project_reporter : testcase_project_reporter
|
51
|
-
|
52
|
-
testcase = correct_testcase_project_reporter.find_or_create_testcase(test)
|
45
|
+
testcase = testcase_project_reporter.find_or_create_testcase(test)
|
53
46
|
# The API returns the test case with an issue URL since it is technically a type of issue.
|
54
47
|
# This updates the URL to a valid test case link.
|
55
48
|
test.testcase = testcase.web_url.sub('/issues/', '/quality/test_cases/')
|
56
49
|
|
57
50
|
issue, is_new = results_issue_project_reporter.get_related_issue(testcase, test)
|
58
51
|
|
59
|
-
|
52
|
+
testcase_project_reporter.add_issue_link_to_testcase(testcase, issue, test) if is_new
|
60
53
|
|
61
|
-
|
54
|
+
testcase_project_reporter.update_testcase(testcase, test)
|
62
55
|
results_issue_project_reporter.update_issue(issue, test)
|
63
56
|
end
|
64
|
-
|
65
|
-
def using_old_testcase_link(test)
|
66
|
-
test.testcase&.include?(results_issue_project)
|
67
|
-
end
|
68
57
|
end
|
69
58
|
end
|
70
59
|
end
|
@@ -1,10 +1,13 @@
|
|
1
|
+
require 'active_support/core_ext/object/blank'
|
1
2
|
require 'securerandom'
|
3
|
+
require 'rainbow/refinement'
|
2
4
|
|
3
5
|
module Gitlab
|
4
6
|
module QA
|
5
7
|
module Runtime
|
6
8
|
module Env
|
7
9
|
extend self
|
10
|
+
using Rainbow
|
8
11
|
|
9
12
|
# Variables that are used in tests and are passed through to the docker container that executes the tests.
|
10
13
|
# These variables should be listed in /docs/what_tests_can_be_run.md#supported-gitlab-environment-variables
|
@@ -33,6 +36,7 @@ module Gitlab
|
|
33
36
|
'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
|
34
37
|
'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
|
35
38
|
'QA_GENERATE_ALLURE_REPORT' => :generate_allure_report,
|
39
|
+
'QA_EE_ACTIVATION_CODE' => :ee_activation_code,
|
36
40
|
'QA_EXPORT_TEST_METRICS' => :qa_export_test_metrics,
|
37
41
|
'QA_INFLUXDB_URL' => :qa_influxdb_url,
|
38
42
|
'QA_INFLUXDB_TOKEN' => :qa_influxdb_token,
|
@@ -76,6 +80,7 @@ module Gitlab
|
|
76
80
|
'KNAPSACK_REPORT_PATH' => :knapsack_report_path,
|
77
81
|
'KNAPSACK_TEST_FILE_PATTERN' => :knapsack_test_file_pattern,
|
78
82
|
'KNAPSACK_TEST_DIR' => :knapsack_test_dir,
|
83
|
+
'QA_KNAPSACK_REPORT_GCS_CREDENTIALS' => :qa_knapsack_report_gcs_credentials,
|
79
84
|
'CI' => :ci,
|
80
85
|
'CI_COMMIT_REF_NAME' => :ci_commit_ref_name,
|
81
86
|
'CI_JOB_NAME' => :ci_job_name,
|
@@ -124,14 +129,15 @@ module Gitlab
|
|
124
129
|
'GCS_BUCKET_NAME' => :gcs_bucket_name,
|
125
130
|
'SMOKE_ONLY' => :smoke_only,
|
126
131
|
'NO_ADMIN' => :no_admin,
|
127
|
-
'CHROME_DISABLE_DEV_SHM' => :chrome_disable_dev_shm
|
132
|
+
'CHROME_DISABLE_DEV_SHM' => :chrome_disable_dev_shm,
|
133
|
+
'COLORIZED_LOGS' => :colorized_logs
|
128
134
|
}.freeze
|
129
135
|
|
130
136
|
ENV_VARIABLES.each do |env_name, method_name|
|
131
137
|
attr_writer(method_name)
|
132
138
|
|
133
139
|
define_method(method_name) do
|
134
|
-
|
140
|
+
env_var_value_if_defined(env_name) || (instance_variable_get("@#{method_name}") if instance_variable_defined?("@#{method_name}"))
|
135
141
|
end
|
136
142
|
end
|
137
143
|
|
@@ -141,36 +147,40 @@ module Gitlab
|
|
141
147
|
ENV_VARIABLES.each do |name, attribute|
|
142
148
|
# Variables that are overridden in the environment take precedence
|
143
149
|
# over the defaults specified by the QA runtime.
|
144
|
-
value =
|
150
|
+
value = env_var_name_if_defined(name) || send(attribute) # rubocop:disable GitlabSecurity/PublicSend
|
145
151
|
vars[name] = value if value
|
146
152
|
end
|
147
153
|
|
148
154
|
vars
|
149
155
|
end
|
150
156
|
|
157
|
+
def debug?
|
158
|
+
enabled?(ENV['QA_DEBUG'], default: true)
|
159
|
+
end
|
160
|
+
|
151
161
|
def default_branch
|
152
|
-
|
162
|
+
env_var_value_if_defined('QA_DEFAULT_BRANCH') || 'main'
|
153
163
|
end
|
154
164
|
|
155
165
|
def gitlab_availability_timeout
|
156
|
-
|
166
|
+
(env_var_value_if_defined('GITLAB_QA_AVAILABILITY_TIMEOUT') || 360).to_i
|
157
167
|
end
|
158
168
|
|
159
169
|
def gitlab_username
|
160
|
-
|
170
|
+
env_var_value_if_defined('GITLAB_USERNAME') || 'gitlab-qa'
|
161
171
|
end
|
162
172
|
|
163
173
|
def gitlab_dev_username
|
164
|
-
|
174
|
+
env_var_value_if_defined('GITLAB_DEV_USERNAME') || 'gitlab-qa-bot'
|
165
175
|
end
|
166
176
|
|
167
177
|
def gitlab_api_base
|
168
|
-
|
178
|
+
env_var_value_if_defined('GITLAB_API_BASE') || 'https://gitlab.com/api/v4'
|
169
179
|
end
|
170
180
|
|
171
181
|
def pipeline_from_project_name
|
172
182
|
if ci_project_name.to_s.start_with?('gitlab-qa')
|
173
|
-
if
|
183
|
+
if env_var_value_if_defined('TOP_UPSTREAM_SOURCE_JOB').to_s.start_with?('https://ops.gitlab.net')
|
174
184
|
'staging-orchestrated'
|
175
185
|
else
|
176
186
|
QA::Runtime::Env.default_branch
|
@@ -184,24 +194,28 @@ module Gitlab
|
|
184
194
|
@run_id ||= "gitlab-qa-run-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}-#{SecureRandom.hex(4)}"
|
185
195
|
end
|
186
196
|
|
197
|
+
def colorized_logs?
|
198
|
+
enabled?(ENV['COLORIZED_LOGS'], default: false)
|
199
|
+
end
|
200
|
+
|
187
201
|
def dev_access_token_variable
|
188
|
-
|
202
|
+
env_var_name_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN')
|
189
203
|
end
|
190
204
|
|
191
205
|
def initial_root_password
|
192
|
-
|
206
|
+
env_var_value_if_defined('GITLAB_INITIAL_ROOT_PASSWORD') || '5iveL!fe'
|
193
207
|
end
|
194
208
|
|
195
209
|
def deploy_environment
|
196
|
-
|
210
|
+
env_var_value_if_defined('DEPLOY_ENVIRONMENT') || pipeline_from_project_name
|
197
211
|
end
|
198
212
|
|
199
213
|
def host_artifacts_dir
|
200
|
-
@host_artifacts_dir ||= File.join(
|
214
|
+
@host_artifacts_dir ||= File.join(env_var_value_if_defined('QA_ARTIFACTS_DIR') || '/tmp/gitlab-qa', Runtime::Env.run_id)
|
201
215
|
end
|
202
216
|
|
203
217
|
def elastic_version
|
204
|
-
|
218
|
+
env_var_value_if_defined('ELASTIC_VERSION') || '6.4.2'.freeze
|
205
219
|
end
|
206
220
|
|
207
221
|
def require_license!
|
@@ -217,25 +231,25 @@ module Gitlab
|
|
217
231
|
end
|
218
232
|
|
219
233
|
def require_qa_access_token!
|
220
|
-
return unless
|
234
|
+
return unless env_var_value_if_defined('GITLAB_QA_ACCESS_TOKEN').to_s.strip.empty?
|
221
235
|
|
222
236
|
raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN"
|
223
237
|
end
|
224
238
|
|
225
239
|
def require_qa_dev_access_token!
|
226
|
-
return unless
|
240
|
+
return unless env_var_value_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN').to_s.strip.empty?
|
227
241
|
|
228
242
|
raise ArgumentError, "Please provide GITLAB_QA_DEV_ACCESS_TOKEN"
|
229
243
|
end
|
230
244
|
|
231
245
|
def require_slack_qa_channel!
|
232
|
-
return unless
|
246
|
+
return unless env_var_value_if_defined('SLACK_QA_CHANNEL').to_s.strip.empty?
|
233
247
|
|
234
248
|
raise ArgumentError, "Please provide SLACK_QA_CHANNEL"
|
235
249
|
end
|
236
250
|
|
237
251
|
def require_ci_slack_webhook_url!
|
238
|
-
return unless
|
252
|
+
return unless env_var_value_if_defined('CI_SLACK_WEBHOOK_URL').to_s.strip.empty?
|
239
253
|
|
240
254
|
raise ArgumentError, "Please provide CI_SLACK_WEBHOOK_URL"
|
241
255
|
end
|
@@ -265,7 +279,7 @@ module Gitlab
|
|
265
279
|
end
|
266
280
|
|
267
281
|
def require_initial_password!
|
268
|
-
return unless
|
282
|
+
return unless env_var_value_if_defined('GITLAB_INITIAL_ROOT_PASSWORD').to_s.strip.empty?
|
269
283
|
|
270
284
|
raise(
|
271
285
|
ArgumentError,
|
@@ -289,11 +303,11 @@ module Gitlab
|
|
289
303
|
end
|
290
304
|
|
291
305
|
def skip_pull?
|
292
|
-
enabled?(
|
306
|
+
enabled?(env_var_value_if_defined('QA_SKIP_PULL'), default: false)
|
293
307
|
end
|
294
308
|
|
295
309
|
def geo_failover?
|
296
|
-
enabled?(
|
310
|
+
enabled?(env_var_value_if_defined('GEO_FAILOVER'), default: false)
|
297
311
|
end
|
298
312
|
|
299
313
|
private
|
@@ -304,9 +318,17 @@ module Gitlab
|
|
304
318
|
(value =~ /^(false|no|0)$/i) != 0
|
305
319
|
end
|
306
320
|
|
307
|
-
def
|
308
|
-
|
309
|
-
|
321
|
+
def env_var_value_valid?(variable)
|
322
|
+
!ENV[variable].blank?
|
323
|
+
end
|
324
|
+
|
325
|
+
def env_var_value_if_defined(variable)
|
326
|
+
return ENV[variable] if env_var_value_valid?(variable)
|
327
|
+
end
|
328
|
+
|
329
|
+
def env_var_name_if_defined(variable)
|
330
|
+
# Pass through the variables if they are defined and not empty in the environment
|
331
|
+
return "$#{variable}" if env_var_value_valid?(variable)
|
310
332
|
end
|
311
333
|
end
|
312
334
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
require 'forwardable'
|
5
|
+
require'rainbow/refinement'
|
6
|
+
|
7
|
+
module Gitlab
|
8
|
+
module QA
|
9
|
+
module Runtime
|
10
|
+
module Logger
|
11
|
+
extend SingleForwardable
|
12
|
+
using Rainbow
|
13
|
+
|
14
|
+
def_delegators :logger, :debug, :info, :warn, :error, :fatal, :unknown
|
15
|
+
|
16
|
+
singleton_class.module_eval do
|
17
|
+
attr_writer :logger
|
18
|
+
|
19
|
+
def logger
|
20
|
+
Rainbow.enabled = Runtime::Env.colorized_logs?
|
21
|
+
|
22
|
+
@logger ||= ::Logger.new($stdout).tap do |logger|
|
23
|
+
logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::INFO
|
24
|
+
|
25
|
+
logger.formatter = proc do |severity, datetime, progname, msg|
|
26
|
+
date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
|
27
|
+
|
28
|
+
"[date=#{date_format} from=GitLab QA] #{severity.ljust(5)}-- ".yellow + "#{msg}\n"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -19,6 +19,7 @@ module Gitlab
|
|
19
19
|
gitlab.instance do
|
20
20
|
Component::Specs.perform do |specs|
|
21
21
|
specs.suite = 'Test::Instance::All'
|
22
|
+
specs.hostname = "qa-e2e-specs.#{gitlab.network}"
|
22
23
|
specs.release = gitlab.release
|
23
24
|
specs.network = gitlab.network
|
24
25
|
specs.args = [gitlab.address, *rspec_args]
|
@@ -12,7 +12,7 @@ module Gitlab
|
|
12
12
|
gitlab.omnibus_configuration << "actioncable['enable'] = true"
|
13
13
|
|
14
14
|
gitlab.instance do
|
15
|
-
|
15
|
+
Runtime::Logger.info('Running actioncable specs!')
|
16
16
|
|
17
17
|
rspec_args << "--" unless rspec_args.include?('--')
|
18
18
|
rspec_args << %w[--tag actioncable]
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
class CloudActivation < Scenario::Template
|
9
|
+
def perform(release, *rspec_args)
|
10
|
+
Component::Gitlab.perform do |gitlab|
|
11
|
+
gitlab.release = release
|
12
|
+
gitlab.network = 'test'
|
13
|
+
|
14
|
+
gitlab.omnibus_configuration << <<~OMNIBUS
|
15
|
+
gitlab_rails['env'] = { 'GITLAB_LICENSE_MODE' => 'test', 'CUSTOMER_PORTAL_URL' => 'https://customers.staging.gitlab.com' }
|
16
|
+
OMNIBUS
|
17
|
+
|
18
|
+
gitlab.instance do
|
19
|
+
rspec_args << "--" unless rspec_args.include?('--')
|
20
|
+
rspec_args << %w[--tag cloud_activation]
|
21
|
+
|
22
|
+
Component::Specs.perform do |specs|
|
23
|
+
specs.suite = 'Test::Instance::All'
|
24
|
+
specs.release = gitlab.release
|
25
|
+
specs.network = gitlab.network
|
26
|
+
specs.args = [gitlab.address, *rspec_args]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -64,7 +64,7 @@ module Gitlab
|
|
64
64
|
prepare; start; reconfigure; process_exec_commands
|
65
65
|
|
66
66
|
# shellout to instance specs
|
67
|
-
|
67
|
+
Runtime::Logger.info('Running Geo primary / secondary specs!')
|
68
68
|
|
69
69
|
Component::Specs.perform do |specs|
|
70
70
|
specs.suite = 'QA::EE::Scenario::Test::Geo'
|
@@ -50,7 +50,7 @@ module Gitlab
|
|
50
50
|
|
51
51
|
gitlab.omnibus_configuration << gitlab_omnibus_configuration
|
52
52
|
gitlab.instance do
|
53
|
-
|
53
|
+
Runtime::Logger.info('Running Gitaly Cluster specs!')
|
54
54
|
|
55
55
|
if @tag
|
56
56
|
rspec_args << "--" unless rspec_args.include?('--')
|
@@ -47,7 +47,7 @@ module Gitlab
|
|
47
47
|
|
48
48
|
retry_count += 1
|
49
49
|
wait_seconds = response["retry-after"].to_i
|
50
|
-
|
50
|
+
Runtime::Logger.debug("Received 429 - Too many requests. Waiting for #{wait_seconds} seconds.")
|
51
51
|
sleep wait_seconds
|
52
52
|
end
|
53
53
|
|
data/lib/gitlab/qa/version.rb
CHANGED
data/lib/gitlab/qa.rb
CHANGED
@@ -9,6 +9,7 @@ module Gitlab
|
|
9
9
|
autoload :Scenario, 'gitlab/qa/runtime/scenario'
|
10
10
|
autoload :TokenFinder, 'gitlab/qa/runtime/token_finder'
|
11
11
|
autoload :OmnibusConfiguration, 'gitlab/qa/runtime/omnibus_configuration'
|
12
|
+
autoload :Logger, 'gitlab/qa/runtime/logger'
|
12
13
|
|
13
14
|
module OmnibusConfigurations
|
14
15
|
autoload :Default, 'gitlab/qa/runtime/omnibus_configurations/default'
|
@@ -73,6 +74,7 @@ module Gitlab
|
|
73
74
|
autoload :Registry, 'gitlab/qa/scenario/test/integration/registry'
|
74
75
|
autoload :RegistryTLS, 'gitlab/qa/scenario/test/integration/registry_tls'
|
75
76
|
autoload :ServicePingDisabled, 'gitlab/qa/scenario/test/integration/service_ping_disabled'
|
77
|
+
autoload :CloudActivation, 'gitlab/qa/scenario/test/integration/cloud_activation'
|
76
78
|
end
|
77
79
|
|
78
80
|
module Sanity
|
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: 7.
|
4
|
+
version: 7.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 4.
|
131
|
+
version: 4.18.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 4.
|
138
|
+
version: 4.18.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: http
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '1.10'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rainbow
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 3.0.0
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 3.0.0
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: table_print
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,6 +280,7 @@ files:
|
|
266
280
|
- lib/gitlab/qa/reporter.rb
|
267
281
|
- lib/gitlab/qa/runner.rb
|
268
282
|
- lib/gitlab/qa/runtime/env.rb
|
283
|
+
- lib/gitlab/qa/runtime/logger.rb
|
269
284
|
- lib/gitlab/qa/runtime/omnibus_configuration.rb
|
270
285
|
- lib/gitlab/qa/runtime/omnibus_configurations/default.rb
|
271
286
|
- lib/gitlab/qa/runtime/omnibus_configurations/license_mode.rb
|
@@ -295,6 +310,7 @@ files:
|
|
295
310
|
- lib/gitlab/qa/scenario/test/instance/staging_ref.rb
|
296
311
|
- lib/gitlab/qa/scenario/test/integration/actioncable.rb
|
297
312
|
- lib/gitlab/qa/scenario/test/integration/client_ssl.rb
|
313
|
+
- lib/gitlab/qa/scenario/test/integration/cloud_activation.rb
|
298
314
|
- lib/gitlab/qa/scenario/test/integration/elasticsearch.rb
|
299
315
|
- lib/gitlab/qa/scenario/test/integration/geo.rb
|
300
316
|
- lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb
|