gitlab-qa 7.8.0 → 7.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +2 -0
- data/docs/what_tests_can_be_run.md +4 -0
- data/lib/gitlab/qa/report/results_in_issues.rb +53 -34
- data/lib/gitlab/qa/runtime/env.rb +25 -18
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8e6f385001950cb2511426d82a6acac3c3615683b8dbd48214df976c6fb07d5
|
4
|
+
data.tar.gz: 51de85c6c9c5dca24ba24961d45005d9ff2bbe168d7a8819f54ee6412ab0abcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4ee08298871f1dff0ce9e0c007ac1c7e6d643fd13161f38beac5a59574a43931abf87a904488ba1b9e6037d451b22ad151b10afed9df41ed68bf39b1500e18e
|
7
|
+
data.tar.gz: 266d10c931d8762dcfb34e9aa07f44a38dd1656cccbdd38a7e559ce04d8fec2144f5156f8b8cc4a372db9420a064940861e17146e78d77c0966cbd497e5a4001
|
data/.gitlab-ci.yml
CHANGED
@@ -158,6 +158,7 @@ rspec:
|
|
158
158
|
ce:sanity-framework:
|
159
159
|
variables:
|
160
160
|
QA_GENERATE_ALLURE_REPORT: "false"
|
161
|
+
QA_EXPORT_TEST_METRICS: "false"
|
161
162
|
script:
|
162
163
|
- ./bin/expect_exit_code_and_text "bundle exec exe/gitlab-qa Test::Instance::Image ${RELEASE:=CE} -- --tag framework" 1 "2 examples, 1 failure"
|
163
164
|
extends:
|
@@ -168,6 +169,7 @@ ce:sanity-framework:
|
|
168
169
|
ee:sanity-framework:
|
169
170
|
variables:
|
170
171
|
QA_GENERATE_ALLURE_REPORT: "false"
|
172
|
+
QA_EXPORT_TEST_METRICS: "false"
|
171
173
|
script:
|
172
174
|
- ./bin/expect_exit_code_and_text "bundle exec exe/gitlab-qa Test::Instance::Image ${RELEASE:=EE} -- --tag framework" 1 "2 examples, 1 failure"
|
173
175
|
extends:
|
@@ -74,6 +74,10 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
|
|
74
74
|
| `QA_SLOW_CONNECTION_THROUGHPUT_KBPS` | `32` | The maximum throughput (in kbps) of the simulated slow connection. | No|
|
75
75
|
| `QA_SKIP_PULL` | `false` | Set to `true` to skip pulling docker images (e.g., to use one you built locally). | No|
|
76
76
|
| `QA_GENERATE_ALLURE_REPORT` | `false` | When running on CI, set to `true` to generate allure reports | No|
|
77
|
+
| `QA_EXPORT_TEST_METRICS` | `true` | When running on CI, set to `true` to export test metrics to influxdb | No|
|
78
|
+
| `QA_INFLUXDB_URL` |- | Influxdb url for test metrics reporting | No|
|
79
|
+
| `QA_INFLUXDB_TOKEN` |- | Influxdb token for test metrics reporting | No|
|
80
|
+
| `QA_RUN_TYPE` |- | QA run type like `staging-full`, `canary`, `production` etc. Used in test metrics reporting | No|
|
77
81
|
| `GITHUB_USERNAME` |- | Username for authenticating with GitHub. | No|
|
78
82
|
| `GITHUB_PASSWORD` |- | Password for authenticating with GitHub. | No|
|
79
83
|
| `GITLAB_QA_LOOP_RUNNER_MINUTES` | `1` | Minutes to run and repeat a spec while using the '--loop' option; default value is 1 minute. | No|
|
@@ -19,6 +19,8 @@ module Gitlab
|
|
19
19
|
puts "Reporting tests in #{test_results.path}"
|
20
20
|
|
21
21
|
test_results.each do |test|
|
22
|
+
puts "Reporting test: #{test.file} | #{test.name}\n"
|
23
|
+
|
22
24
|
report_test(test) unless test.skipped
|
23
25
|
end
|
24
26
|
|
@@ -27,19 +29,18 @@ module Gitlab
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def report_test(test)
|
30
|
-
puts "Reporting test: #{test.file} | #{test.name}"
|
31
|
-
|
32
32
|
testcase = find_testcase(test) || create_testcase(test)
|
33
33
|
test.testcase ||= testcase.web_url.sub('/issues/', '/quality/test_cases/')
|
34
34
|
|
35
|
-
issue =
|
35
|
+
issue = find_linked_results_issue_by_iid(testcase, test)
|
36
36
|
|
37
|
-
|
37
|
+
if issue
|
38
|
+
issue = update_issue_title(issue, test, 'issue') if issue.title.strip != title_from_test(test)
|
39
|
+
else
|
38
40
|
puts "No valid issue link found"
|
39
|
-
issue =
|
41
|
+
issue = find_or_create_results_issue(test)
|
40
42
|
|
41
43
|
add_issue_to_testcase(testcase, issue)
|
42
|
-
puts "Added issue #{issue.web_url} to testcase #{testcase.web_url}"
|
43
44
|
end
|
44
45
|
|
45
46
|
update_labels(testcase, test)
|
@@ -47,15 +48,47 @@ module Gitlab
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def find_testcase(test)
|
50
|
-
|
51
|
+
testcase = find_testcase_by_iid(test)
|
52
|
+
|
53
|
+
if testcase
|
54
|
+
testcase = update_issue_title(testcase, test, 'test_case') if testcase.title.strip != title_from_test(test)
|
55
|
+
else
|
56
|
+
testcase = find_issue(test, 'test_case')
|
57
|
+
end
|
58
|
+
|
59
|
+
testcase
|
60
|
+
end
|
61
|
+
|
62
|
+
def find_testcase_by_iid(test)
|
63
|
+
iid = testcase_iid_from_url(test.testcase)
|
64
|
+
|
65
|
+
return unless iid
|
66
|
+
|
67
|
+
find_issue_by_iid(iid, 'test_case')
|
68
|
+
end
|
69
|
+
|
70
|
+
def find_linked_results_issue_by_iid(testcase, test)
|
71
|
+
iid = issue_iid_from_testcase(testcase)
|
72
|
+
|
73
|
+
return unless iid
|
74
|
+
|
75
|
+
find_issue_by_iid(iid, 'issue')
|
76
|
+
end
|
51
77
|
|
52
|
-
|
78
|
+
def find_issue_by_iid(iid, issue_type)
|
79
|
+
issues = gitlab.find_issues(iid: iid) do |issue|
|
80
|
+
issue.state == 'opened' && issue.issue_type == issue_type
|
81
|
+
end
|
53
82
|
|
54
|
-
warn(%(
|
83
|
+
warn(%(#{issue_type} iid "#{iid}" not valid)) if issues.empty?
|
55
84
|
|
56
|
-
|
85
|
+
issues.first
|
86
|
+
end
|
57
87
|
|
58
|
-
|
88
|
+
def update_issue_title(issue, test, issue_type)
|
89
|
+
warn(%(#{issue_type} title needs to be updated from '#{issue.title.strip}' to '#{title_from_test(test)}'))
|
90
|
+
|
91
|
+
gitlab.edit_issue(iid: issue.iid, options: { title: title_from_test(test) })
|
59
92
|
end
|
60
93
|
|
61
94
|
def create_testcase(test)
|
@@ -70,8 +103,8 @@ module Gitlab
|
|
70
103
|
)
|
71
104
|
end
|
72
105
|
|
73
|
-
def
|
74
|
-
return warn(%(
|
106
|
+
def testcase_iid_from_url(url)
|
107
|
+
return warn(%(\nPlease update #{url} to test case url")) if url&.include?('/-/issues/')
|
75
108
|
|
76
109
|
url && url.split('/').last.to_i
|
77
110
|
end
|
@@ -90,7 +123,7 @@ module Gitlab
|
|
90
123
|
issue_iid&.to_i
|
91
124
|
end
|
92
125
|
|
93
|
-
def
|
126
|
+
def find_or_create_results_issue(test)
|
94
127
|
issue = find_issue(test, 'issue')
|
95
128
|
|
96
129
|
if issue
|
@@ -103,22 +136,12 @@ module Gitlab
|
|
103
136
|
issue
|
104
137
|
end
|
105
138
|
|
106
|
-
def find_issue_by_iid(testcase, test)
|
107
|
-
iid = issue_iid_from_testcase(testcase)
|
108
|
-
|
109
|
-
return unless iid
|
110
|
-
|
111
|
-
issues = search_issues(test: test, issue_type: 'issue', iid: iid)
|
112
|
-
|
113
|
-
warn(%(Issue iid "#{iid}" not valid)) if issues.empty?
|
114
|
-
|
115
|
-
issues.first
|
116
|
-
end
|
117
|
-
|
118
139
|
def find_issue(test, issue_type)
|
119
|
-
issues =
|
140
|
+
issues = gitlab.find_issues(options: { search: search_term(test) }) do |issue|
|
141
|
+
issue.state == 'opened' && issue.issue_type == issue_type && issue.title.strip == title_from_test(test)
|
142
|
+
end
|
120
143
|
|
121
|
-
warn(%(Too many
|
144
|
+
warn(%(Too many #{issue_type}s found with the file path "#{test.file}" and name "#{test.name}")) if issues.many?
|
122
145
|
|
123
146
|
issues.first
|
124
147
|
end
|
@@ -127,6 +150,8 @@ module Gitlab
|
|
127
150
|
results_section = testcase.description.include?(RESULTS_SECTION_TEMPLATE) ? '' : RESULTS_SECTION_TEMPLATE
|
128
151
|
|
129
152
|
gitlab.edit_issue(iid: testcase.iid, options: { description: (testcase.description + results_section + "\n\n#{issue.web_url}") })
|
153
|
+
|
154
|
+
puts "Added issue #{issue.web_url} to testcase #{testcase.web_url}"
|
130
155
|
end
|
131
156
|
|
132
157
|
def update_issue(issue, test)
|
@@ -154,12 +179,6 @@ module Gitlab
|
|
154
179
|
labels << (test.failures.empty? ? "#{pipeline}::passed" : "#{pipeline}::failed")
|
155
180
|
end
|
156
181
|
|
157
|
-
def search_issues(test:, issue_type:, iid: nil)
|
158
|
-
gitlab.find_issues(iid: iid, options: { search: search_term(test) }) do |issue|
|
159
|
-
issue.state == 'opened' && issue.issue_type == issue_type && issue.title.strip == title_from_test(test)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
182
|
def search_term(test)
|
164
183
|
%("#{partial_file_path(test.file)}" "#{search_safe(test.name)}")
|
165
184
|
end
|
@@ -16,6 +16,26 @@ module Gitlab
|
|
16
16
|
'QA_REMOTE_GRID_ACCESS_KEY' => :remote_grid_access_key,
|
17
17
|
'QA_REMOTE_GRID_PROTOCOL' => :remote_grid_protocol,
|
18
18
|
'QA_BROWSER' => :browser,
|
19
|
+
'QA_ADDITIONAL_REPOSITORY_STORAGE' => :qa_additional_repository_storage,
|
20
|
+
'QA_PRAEFECT_REPOSITORY_STORAGE' => :qa_praefect_repository_storage,
|
21
|
+
'QA_GITALY_NON_CLUSTER_STORAGE' => :qa_gitaly_non_cluster_storage,
|
22
|
+
'QA_COOKIES' => :qa_cookie,
|
23
|
+
'QA_DEBUG' => :qa_debug,
|
24
|
+
'QA_DEFAULT_BRANCH' => :qa_default_branch,
|
25
|
+
'QA_LOG_PATH' => :qa_log_path,
|
26
|
+
'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
|
27
|
+
'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
|
28
|
+
'QA_CAN_TEST_PRAEFECT' => :qa_can_test_praefect,
|
29
|
+
'QA_DISABLE_RSPEC_RETRY' => :qa_disable_rspec_retry,
|
30
|
+
'QA_SIMULATE_SLOW_CONNECTION' => :qa_simulate_slow_connection,
|
31
|
+
'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
|
32
|
+
'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
|
33
|
+
'QA_GENERATE_ALLURE_REPORT' => :generate_allure_report,
|
34
|
+
'QA_EXPORT_TEST_METRICS' => :qa_export_test_metrics,
|
35
|
+
'QA_INFLUXDB_URL' => :qa_influxdb_url,
|
36
|
+
'QA_INFLUXDB_TOKEN' => :qa_influxdb_token,
|
37
|
+
'QA_RUN_TYPE' => :qa_run_type,
|
38
|
+
'QA_SKIP_PULL' => :qa_skip_pull,
|
19
39
|
'GITLAB_API_BASE' => :api_base,
|
20
40
|
'GITLAB_ADMIN_USERNAME' => :admin_username,
|
21
41
|
'GITLAB_ADMIN_PASSWORD' => :admin_password,
|
@@ -40,21 +60,6 @@ module Gitlab
|
|
40
60
|
'CLOUDSDK_CORE_PROJECT' => :cloudsdk_core_project,
|
41
61
|
'GCLOUD_REGION' => :gcloud_region,
|
42
62
|
'SIGNUP_DISABLED' => :signup_disabled,
|
43
|
-
'QA_ADDITIONAL_REPOSITORY_STORAGE' => :qa_additional_repository_storage,
|
44
|
-
'QA_PRAEFECT_REPOSITORY_STORAGE' => :qa_praefect_repository_storage,
|
45
|
-
'QA_GITALY_NON_CLUSTER_STORAGE' => :qa_gitaly_non_cluster_storage,
|
46
|
-
'QA_COOKIES' => :qa_cookie,
|
47
|
-
'QA_DEBUG' => :qa_debug,
|
48
|
-
'QA_DEFAULT_BRANCH' => :qa_default_branch,
|
49
|
-
'QA_LOG_PATH' => :qa_log_path,
|
50
|
-
'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
|
51
|
-
'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
|
52
|
-
'QA_CAN_TEST_PRAEFECT' => :qa_can_test_praefect,
|
53
|
-
'QA_DISABLE_RSPEC_RETRY' => :qa_disable_rspec_retry,
|
54
|
-
'QA_SIMULATE_SLOW_CONNECTION' => :qa_simulate_slow_connection,
|
55
|
-
'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
|
56
|
-
'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
|
57
|
-
'QA_GENERATE_ALLURE_REPORT' => :generate_allure_report,
|
58
63
|
'GITLAB_QA_USERNAME_1' => :gitlab_qa_username_1,
|
59
64
|
'GITLAB_QA_PASSWORD_1' => :gitlab_qa_password_1,
|
60
65
|
'GITLAB_QA_USERNAME_2' => :gitlab_qa_username_2,
|
@@ -74,13 +79,14 @@ module Gitlab
|
|
74
79
|
'CI_NODE_INDEX' => :ci_node_index,
|
75
80
|
'CI_NODE_TOTAL' => :ci_node_total,
|
76
81
|
'CI_PROJECT_NAME' => :ci_project_name,
|
82
|
+
'CI_SLACK_WEBHOOK_URL' => :ci_slack_webhook_url,
|
83
|
+
'CI_PIPELINE_CREATED_AT' => :ci_pipeline_created_at,
|
84
|
+
'CI_MERGE_REQUEST_IID' => :ci_merge_request_iid,
|
77
85
|
'GITLAB_CI' => :gitlab_ci,
|
78
|
-
'QA_SKIP_PULL' => :qa_skip_pull,
|
79
86
|
'ELASTIC_URL' => :elastic_url,
|
80
87
|
'GITLAB_QA_LOOP_RUNNER_MINUTES' => :gitlab_qa_loop_runner_minutes,
|
81
88
|
'MAILHOG_HOSTNAME' => :mailhog_hostname,
|
82
89
|
'SLACK_QA_CHANNEL' => :slack_qa_channel,
|
83
|
-
'CI_SLACK_WEBHOOK_URL' => :ci_slack_webhook_url,
|
84
90
|
'SLACK_ICON_EMOJI' => :slack_icon_emoji,
|
85
91
|
'GITLAB_QA_FORMLESS_LOGIN_TOKEN' => :gitlab_qa_formless_login_token,
|
86
92
|
'GEO_MAX_FILE_REPLICATION_TIME' => :geo_max_file_replication_time,
|
@@ -97,7 +103,8 @@ module Gitlab
|
|
97
103
|
'AWS_S3_REGION' => :aws_s3_region,
|
98
104
|
'AWS_S3_KEY_ID' => :aws_s3_key_id,
|
99
105
|
'AWS_S3_ACCESS_KEY' => :aws_s3_access_key,
|
100
|
-
'AWS_S3_BUCKET_NAME' => :aws_s3_bucket_name
|
106
|
+
'AWS_S3_BUCKET_NAME' => :aws_s3_bucket_name,
|
107
|
+
'TOP_UPSTREAM_MERGE_REQUEST_IID' => :top_upstream_merge_request_iid
|
101
108
|
}.freeze
|
102
109
|
|
103
110
|
ENV_VARIABLES.each do |env_name, method_name|
|
data/lib/gitlab/qa/version.rb
CHANGED
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.8.
|
4
|
+
version: 7.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|