gitlab-qa 6.9.0 → 6.13.0
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 +8 -8
- data/docs/running_specific_orchestrated_tests.md +1 -1
- data/docs/what_tests_can_be_run.md +1 -0
- data/gitlab-qa.gemspec +2 -2
- data/lib/gitlab/qa/component/base.rb +7 -0
- data/lib/gitlab/qa/docker/engine.rb +8 -0
- data/lib/gitlab/qa/report/generate_test_session.rb +31 -6
- data/lib/gitlab/qa/report/gitlab_issue_client.rb +4 -1
- data/lib/gitlab/qa/report/relate_failure_issue.rb +25 -10
- data/lib/gitlab/qa/report/report_as_issue.rb +22 -1
- data/lib/gitlab/qa/report/results_in_issues.rb +15 -11
- data/lib/gitlab/qa/report/test_result.rb +9 -0
- data/lib/gitlab/qa/runtime/env.rb +8 -3
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0692b909c3bf06d12d5f0846dc3296b93755d0c58c5969a71773e9664b298a8c'
|
4
|
+
data.tar.gz: 3aac312bb7b6dd2244d92b9bbf9ce1ecf561c65caae723abca625b155c00cfa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c3a6b9ad1eec8d6adf2892ae3b90568bbfebc7f7def626126ae2b14da9be902b71edd8d45a7c98a3cb89b596fa6cee6b352da159f7e3ae1ca2daf8b37dc176
|
7
|
+
data.tar.gz: 4554af9b7849516651be2e5f32f4fd5d57690b4af2787292d4b18e6a8838fad92201a9d101edcbc9c2391327322fdaca96a37393fe6ea1a3111f734be7934d2f
|
data/.gitlab-ci.yml
CHANGED
@@ -49,9 +49,9 @@ variables:
|
|
49
49
|
QA_CAN_TEST_GIT_PROTOCOL_V2: "true"
|
50
50
|
QA_CAN_TEST_PRAEFECT: "false"
|
51
51
|
QA_TESTCASES_REPORTING_PROJECT: "gitlab-org/quality/testcases"
|
52
|
-
QA_FAILURES_REPORTING_PROJECT: "gitlab-
|
52
|
+
QA_FAILURES_REPORTING_PROJECT: "rymai/gitlab-qa-issues"
|
53
53
|
# The --dry-run or --max-diff-ratio option can be set to modify the behavior of `exe/gitlab-qa-report --relate-failure-issue` without releasing a new gem version.
|
54
|
-
QA_FAILURES_REPORTER_OPTIONS: "
|
54
|
+
QA_FAILURES_REPORTER_OPTIONS: ""
|
55
55
|
QA_TESTCASE_SESSIONS_PROJECT: "gitlab-org/quality/testcase-sessions"
|
56
56
|
|
57
57
|
.check-base:
|
@@ -95,8 +95,8 @@ release:
|
|
95
95
|
reports:
|
96
96
|
junit: gitlab-qa-run-*/**/rspec-*.xml
|
97
97
|
script:
|
98
|
-
- 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
|
99
|
-
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
98
|
+
- 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
|
99
|
+
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
100
100
|
- exe/gitlab-qa-report --update-screenshot-path "gitlab-qa-run-*/**/rspec-*.xml"
|
101
101
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
102
102
|
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
|
@@ -175,8 +175,8 @@ ee:sanity-framework:
|
|
175
175
|
# The custom jobs are for manually running specific/alternative tests in MRs, so we don't report them in issues
|
176
176
|
ce:custom-parallel:
|
177
177
|
script:
|
178
|
-
- 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
|
179
|
-
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
|
178
|
+
- 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
|
179
|
+
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
|
180
180
|
extends:
|
181
181
|
- .test
|
182
182
|
- .high-capacity
|
@@ -187,8 +187,8 @@ ce:custom-parallel:
|
|
187
187
|
|
188
188
|
ee:custom-parallel:
|
189
189
|
script:
|
190
|
-
- 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
|
191
|
-
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
|
190
|
+
- 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
|
191
|
+
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
|
192
192
|
extends:
|
193
193
|
- .test
|
194
194
|
- .high-capacity
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
The [maven repository spec](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/qa/specs/features/ee/browser_ui/5_package/maven_repository_spec.rb) creates a Maven artifact and links it to a GitLab project. The artifact is created within a [Maven docker image](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/qa/service/docker_run/maven.rb#L8).
|
6
6
|
|
7
|
-
Using `gitlab-qa` to run these tests reduces the
|
7
|
+
Using `gitlab-qa` to run these tests reduces the likelihood of network errors between the maven container and GitLab instance.
|
8
8
|
|
9
9
|
To run this with `gitlab-qa` you can use the `Test::Instance::Image` that is needed for your test. For example:
|
10
10
|
|
@@ -84,6 +84,7 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
|
|
84
84
|
| `JIRA_ADMIN_PASSWORD` |- | Password for authenticating with Jira server as admin. | No|
|
85
85
|
| `CACHE_NAMESPACE_NAME` | `true` | Cache namespace name for groups. | No|
|
86
86
|
| `DEPLOY_VERSION` |- | The version of GitLab being tested against. | No|
|
87
|
+
| `GITLAB_QA_USER_AGENT` |- | The browser user-agent to use instead of the default Chrome user-agent. | No|
|
87
88
|
|
88
89
|
## [Supported Remote Grid environment variables](./running_against_remote_grid.md)
|
89
90
|
|
data/gitlab-qa.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency 'rubocop', '~> 0.82.0'
|
28
28
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.36'
|
29
29
|
spec.add_development_dependency 'webmock', '3.7.0'
|
30
|
-
spec.add_runtime_dependency 'activesupport', '~>
|
31
|
-
spec.add_runtime_dependency 'gitlab', '~>
|
30
|
+
spec.add_runtime_dependency 'activesupport', '~> 6.0.2'
|
31
|
+
spec.add_runtime_dependency 'gitlab', '~> 4.16.1'
|
32
32
|
spec.add_runtime_dependency 'http', '4.3.0'
|
33
33
|
spec.add_runtime_dependency 'nokogiri', '~> 1.10'
|
34
34
|
spec.add_runtime_dependency 'table_print', '1.5.6'
|
@@ -53,6 +53,7 @@ module Gitlab
|
|
53
53
|
|
54
54
|
def prepare
|
55
55
|
prepare_docker_image
|
56
|
+
prepare_docker_container
|
56
57
|
prepare_network
|
57
58
|
end
|
58
59
|
|
@@ -70,6 +71,12 @@ module Gitlab
|
|
70
71
|
docker.network_create(network)
|
71
72
|
end
|
72
73
|
|
74
|
+
def prepare_docker_container
|
75
|
+
return unless docker.container_exists?(name)
|
76
|
+
|
77
|
+
docker.remove(name)
|
78
|
+
end
|
79
|
+
|
73
80
|
def start # rubocop:disable Metrics/AbcSize
|
74
81
|
docker.run(image, tag) do |command|
|
75
82
|
command << "-d"
|
@@ -63,6 +63,14 @@ module Gitlab
|
|
63
63
|
Docker::Command.execute("rm -f #{name}")
|
64
64
|
end
|
65
65
|
|
66
|
+
def container_exists?(name)
|
67
|
+
Docker::Command.execute("container inspect #{name}")
|
68
|
+
rescue Docker::Shellout::StatusError
|
69
|
+
false
|
70
|
+
else
|
71
|
+
true
|
72
|
+
end
|
73
|
+
|
66
74
|
def network_exists?(name)
|
67
75
|
Docker::Command.execute("network inspect #{name}")
|
68
76
|
rescue Docker::Shellout::StatusError
|
@@ -6,6 +6,7 @@ module Gitlab
|
|
6
6
|
class GenerateTestSession < ReportAsIssue
|
7
7
|
private
|
8
8
|
|
9
|
+
# rubocop:disable Metrics/AbcSize
|
9
10
|
def run!
|
10
11
|
puts "Generating test results in `#{files.join(',')}` as issues in project `#{project}` via the API at `#{Runtime::Env.gitlab_api_base}`."
|
11
12
|
|
@@ -18,11 +19,12 @@ module Gitlab
|
|
18
19
|
issue = gitlab.create_issue(
|
19
20
|
title: "Test session report | #{Runtime::Env.deploy_environment}",
|
20
21
|
description: generate_description(tests),
|
21
|
-
labels: ['Quality', 'QA', 'triage report']
|
22
|
+
labels: ['Quality', 'QA', 'triage report', deploy_environment_label]
|
22
23
|
)
|
23
24
|
|
24
25
|
File.write('REPORT_ISSUE_URL', issue.web_url)
|
25
26
|
end
|
27
|
+
# rubocop:enable Metrics/AbcSize
|
26
28
|
|
27
29
|
def generate_description(tests)
|
28
30
|
<<~MARKDOWN
|
@@ -32,6 +34,8 @@ module Gitlab
|
|
32
34
|
* Pipeline: [#{Runtime::Env.ci_pipeline_id}](#{Runtime::Env.ci_pipeline_url})
|
33
35
|
#{generate_summary(tests: tests)}
|
34
36
|
|
37
|
+
#{generate_failed_jobs_listing}
|
38
|
+
|
35
39
|
#{generate_stages_listing(tests)}
|
36
40
|
|
37
41
|
## Release QA issue
|
@@ -55,6 +59,27 @@ module Gitlab
|
|
55
59
|
MARKDOWN
|
56
60
|
end
|
57
61
|
|
62
|
+
def generate_failed_jobs_listing
|
63
|
+
gitlab.handle_gitlab_client_exceptions do
|
64
|
+
failed_jobs = Gitlab.pipeline_jobs(
|
65
|
+
Runtime::Env.ci_project_id,
|
66
|
+
Runtime::Env.ci_pipeline_id,
|
67
|
+
scope: 'failed')
|
68
|
+
|
69
|
+
listings = failed_jobs.map do |job|
|
70
|
+
allowed_to_fail = ' (allowed to fail)' if job.allow_failure
|
71
|
+
|
72
|
+
"* [#{job.name}](#{job.web_url})#{allowed_to_fail}"
|
73
|
+
end.join("\n")
|
74
|
+
|
75
|
+
<<~MARKDOWN.chomp if failed_jobs.any?
|
76
|
+
## Failed jobs
|
77
|
+
|
78
|
+
#{listings}
|
79
|
+
MARKDOWN
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
58
83
|
def generate_stages_listing(tests)
|
59
84
|
generate_tests_by_stage(tests).map do |stage, tests_for_stage|
|
60
85
|
tests_by_status = tests_for_stage.group_by(&:status)
|
@@ -161,11 +186,11 @@ module Gitlab
|
|
161
186
|
end
|
162
187
|
|
163
188
|
def generate_test_job(tests_with_same_testcase)
|
164
|
-
tests_with_same_testcase.map
|
165
|
-
ci_job_id = ci_job_url[/\d+\z/]
|
189
|
+
tests_with_same_testcase.map do |test|
|
190
|
+
ci_job_id = test.ci_job_url[/\d+\z/]
|
166
191
|
|
167
|
-
"[#{ci_job_id}](#{ci_job_url})"
|
168
|
-
end.join(', ')
|
192
|
+
"[#{ci_job_id}](#{test.ci_job_url})#{' ~"quarantine"' if test.quarantine?}"
|
193
|
+
end.uniq.join(', ')
|
169
194
|
end
|
170
195
|
|
171
196
|
def generate_test_status(tests_with_same_testcase)
|
@@ -185,7 +210,7 @@ module Gitlab
|
|
185
210
|
tests_with_same_testcase.select(&:failure_issue)
|
186
211
|
|
187
212
|
if tests_having_failure_issue.any?
|
188
|
-
items = tests_having_failure_issue.map do |test|
|
213
|
+
items = tests_having_failure_issue.uniq(&:failure_issue).map do |test|
|
189
214
|
"<li>[ ] [failure issue](#{test.failure_issue})</li>"
|
190
215
|
end.join(' ')
|
191
216
|
|
@@ -59,7 +59,7 @@ module Gitlab
|
|
59
59
|
|
60
60
|
def find_issue_discussions(iid:)
|
61
61
|
handle_gitlab_client_exceptions do
|
62
|
-
Gitlab.issue_discussions(project, iid, order_by: 'created_at', sort: 'asc')
|
62
|
+
Gitlab.issue_discussions(project, iid, order_by: 'created_at', sort: 'asc').auto_paginate
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -109,6 +109,9 @@ module Gitlab
|
|
109
109
|
pipeline = QA::Runtime::Env.pipeline_from_project_name
|
110
110
|
channel = pipeline == "canary" ? "qa-production" : "qa-#{pipeline}"
|
111
111
|
error_msg = warn_exception(e)
|
112
|
+
|
113
|
+
return unless QA::Runtime::Env.ci_commit_ref_name == 'master'
|
114
|
+
|
112
115
|
slack_options = {
|
113
116
|
channel: channel,
|
114
117
|
icon_emoji: ':ci_failing:',
|
@@ -10,7 +10,7 @@ module Gitlab
|
|
10
10
|
# Uses the API to create or update GitLab issues with the results of tests from RSpec report files.
|
11
11
|
class RelateFailureIssue < ReportAsIssue
|
12
12
|
DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION = 0.05
|
13
|
-
STACKTRACE_REGEX = %r{### Stack trace\s*(```)\s*.*(Failure/Error
|
13
|
+
STACKTRACE_REGEX = %r{### Stack trace\s*(```)\s*.*(Failure/Error:.+)(\1)}m.freeze
|
14
14
|
NEW_ISSUE_LABELS = Set.new(%w[QA Quality test failure::investigating priority::2]).freeze
|
15
15
|
|
16
16
|
MultipleIssuesFound = Class.new(StandardError)
|
@@ -47,6 +47,7 @@ module Gitlab
|
|
47
47
|
issue = find_or_create_issue(test)
|
48
48
|
return unless issue
|
49
49
|
|
50
|
+
update_labels(issue, test)
|
50
51
|
post_failed_job_note(issue, test)
|
51
52
|
puts " => Marked #{issue.web_url} as related to #{test.testcase}."
|
52
53
|
rescue MultipleIssuesFound => e
|
@@ -81,17 +82,20 @@ module Gitlab
|
|
81
82
|
# Search with the `search` param returns 500 errors, so we filter by ~QA and then filter further in Ruby
|
82
83
|
failure_issues(test).each_with_object({}) do |issue, memo|
|
83
84
|
relevant_issue_stacktrace = find_issue_stacktrace(issue)
|
84
|
-
unless relevant_issue_stacktrace
|
85
|
-
puts " => [DEBUG] Found issue #{issue.web_url} but stacktrace doesn't match."
|
86
|
-
next
|
87
|
-
end
|
85
|
+
next unless relevant_issue_stacktrace
|
88
86
|
|
89
87
|
distance = ld.call(first_test_failure_stacktrace, relevant_issue_stacktrace)
|
90
88
|
diff_ratio = (distance.to_f / first_test_failure_stacktrace.size).round(3)
|
91
89
|
if diff_ratio <= max_diff_ratio
|
92
|
-
|
90
|
+
puts " => [DEBUG] Issue #{issue} has an acceptable diff ratio of #{(diff_ratio * 100).round(2)}%."
|
91
|
+
# The `Gitlab::ObjectifiedHash` class overrides `#hash` which is used by `Hash#[]=` to compute the hash key.
|
92
|
+
# This leads to a `TypeError Exception: no implicit conversion of Hash into Integer` error, so we convert the object to a hash before using it as a Hash key.
|
93
|
+
# See:
|
94
|
+
# - https://gitlab.com/gitlab-org/gitlab-qa/-/merge_requests/587#note_453336995
|
95
|
+
# - https://github.com/NARKOZ/gitlab/commit/cbdbd1e32623f018a8fae39932a8e3bc4d929abb?_pjax=%23js-repo-pjax-container#r44484494
|
96
|
+
memo[issue.to_h] = diff_ratio
|
93
97
|
else
|
94
|
-
puts " => [DEBUG] Found issue #{issue.web_url} but
|
98
|
+
puts " => [DEBUG] Found issue #{issue.web_url} but stacktraces are too different (#{(diff_ratio * 100).round(2)}%)."
|
95
99
|
end
|
96
100
|
end
|
97
101
|
end
|
@@ -102,7 +106,7 @@ module Gitlab
|
|
102
106
|
if issue_stacktrace_match
|
103
107
|
issue_stacktrace_match[2].gsub(/^#.*$/, '').strip
|
104
108
|
else
|
105
|
-
puts "
|
109
|
+
puts " => [DEBUG] Stacktrace couldn't be found for #{issue.web_url}:\n\n#{issue.description}\n\n----------------------------------\n"
|
106
110
|
end
|
107
111
|
end
|
108
112
|
|
@@ -117,24 +121,35 @@ module Gitlab
|
|
117
121
|
raise(MultipleIssuesFound, %(Too many issues found for test '#{test.name}' (`#{test.file}`)!))
|
118
122
|
end
|
119
123
|
|
124
|
+
# Re-instantiate a `Gitlab::ObjectifiedHash` object after having converted it to a hash in #find_relevant_failure_issues above.
|
125
|
+
best_matching_issue = Gitlab::ObjectifiedHash.new(best_matching_issue)
|
126
|
+
|
120
127
|
test.failure_issue ||= best_matching_issue.web_url
|
121
128
|
|
122
129
|
[best_matching_issue, smaller_diff_ratio]
|
123
130
|
end
|
124
131
|
|
125
132
|
def new_issue_description(test)
|
126
|
-
super +
|
133
|
+
super + [
|
134
|
+
"\n\n### Stack trace",
|
135
|
+
"```\n#{test.failures.first['message_lines'].join("\n")}\n```",
|
136
|
+
"First happened in #{test.ci_job_url}."
|
137
|
+
].join("\n\n")
|
127
138
|
end
|
128
139
|
|
129
140
|
def new_issue_labels(test)
|
130
141
|
NEW_ISSUE_LABELS + up_to_date_labels(test: test)
|
131
142
|
end
|
132
143
|
|
144
|
+
def up_to_date_labels(test:, issue: nil)
|
145
|
+
super << deploy_environment_label
|
146
|
+
end
|
147
|
+
|
133
148
|
def post_failed_job_note(issue, test)
|
134
149
|
gitlab.create_issue_note(iid: issue.iid, note: "/relate #{test.testcase}")
|
135
150
|
end
|
136
151
|
|
137
|
-
def
|
152
|
+
def new_issue_title(test)
|
138
153
|
"Failure in #{super}"
|
139
154
|
end
|
140
155
|
end
|
@@ -28,6 +28,10 @@ module Gitlab
|
|
28
28
|
raise NotImplementedError
|
29
29
|
end
|
30
30
|
|
31
|
+
def new_issue_title(test)
|
32
|
+
"#{partial_file_path(test.file)} | #{search_safe(test.name)}".strip
|
33
|
+
end
|
34
|
+
|
31
35
|
def new_issue_description(test)
|
32
36
|
"### Full description\n\n#{search_safe(test.name)}\n\n### File path\n\n#{test.file}"
|
33
37
|
end
|
@@ -100,6 +104,23 @@ module Gitlab
|
|
100
104
|
labels
|
101
105
|
end
|
102
106
|
|
107
|
+
def deploy_environment_label
|
108
|
+
environment = Runtime::Env.deploy_environment
|
109
|
+
|
110
|
+
case environment
|
111
|
+
when 'production'
|
112
|
+
'found:gitlab.com'
|
113
|
+
when 'canary', 'staging'
|
114
|
+
"found:#{environment}.gitlab.com"
|
115
|
+
when 'preprod'
|
116
|
+
'found:pre.gitlab.com'
|
117
|
+
when 'staging-orchestrated', 'nightly', 'master'
|
118
|
+
"found:#{environment}"
|
119
|
+
else
|
120
|
+
raise "No `found:*` label for the `#{environment}` environment!"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
103
124
|
def ee_test?(test)
|
104
125
|
test.file =~ %r{features/ee/(api|browser_ui)}
|
105
126
|
end
|
@@ -113,7 +134,7 @@ module Gitlab
|
|
113
134
|
end
|
114
135
|
|
115
136
|
def title_from_test(test)
|
116
|
-
title =
|
137
|
+
title = new_issue_title(test)
|
117
138
|
|
118
139
|
return title unless title.length > MAX_TITLE_LENGTH
|
119
140
|
|
@@ -25,8 +25,6 @@ module Gitlab
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def report_test(test)
|
28
|
-
return if test.skipped
|
29
|
-
|
30
28
|
puts "Reporting test: #{test.file} | #{test.name}"
|
31
29
|
|
32
30
|
issue = find_issue(test)
|
@@ -34,16 +32,23 @@ module Gitlab
|
|
34
32
|
if issue
|
35
33
|
puts "Found existing issue: #{issue.web_url}"
|
36
34
|
else
|
35
|
+
# Don't create new issues for skipped tests
|
36
|
+
return if test.skipped
|
37
|
+
|
37
38
|
issue = create_issue(test)
|
38
39
|
puts "Created new issue: #{issue.web_url}"
|
39
40
|
end
|
40
41
|
|
41
42
|
test.testcase ||= issue.web_url
|
42
43
|
|
43
|
-
update_labels(issue, test)
|
44
|
-
note_status(issue, test)
|
44
|
+
labels_updated = update_labels(issue, test)
|
45
|
+
note_posted = note_status(issue, test)
|
45
46
|
|
46
|
-
|
47
|
+
if labels_updated || note_posted
|
48
|
+
puts "Issue updated."
|
49
|
+
else
|
50
|
+
puts "Test passed, no update needed."
|
51
|
+
end
|
47
52
|
end
|
48
53
|
|
49
54
|
def find_issue(test)
|
@@ -79,7 +84,8 @@ module Gitlab
|
|
79
84
|
end
|
80
85
|
|
81
86
|
def note_status(issue, test)
|
82
|
-
return if test.
|
87
|
+
return false if test.skipped
|
88
|
+
return false if test.failures.empty?
|
83
89
|
|
84
90
|
note = note_content(test)
|
85
91
|
|
@@ -88,6 +94,8 @@ module Gitlab
|
|
88
94
|
end
|
89
95
|
|
90
96
|
gitlab.create_issue_note(iid: issue.iid, note: note)
|
97
|
+
|
98
|
+
true
|
91
99
|
end
|
92
100
|
|
93
101
|
def note_content(test)
|
@@ -125,11 +133,7 @@ module Gitlab
|
|
125
133
|
end
|
126
134
|
|
127
135
|
def error_and_stack_trace(text)
|
128
|
-
|
129
|
-
|
130
|
-
warn "Could not find `Error:` in text: #{text}" if result.empty?
|
131
|
-
|
132
|
-
result
|
136
|
+
text.strip[/Error:(.*)/m, 1].to_s
|
133
137
|
end
|
134
138
|
end
|
135
139
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support/core_ext/object/blank'
|
4
|
+
|
3
5
|
module Gitlab
|
4
6
|
module QA
|
5
7
|
module Report
|
@@ -78,6 +80,13 @@ module Gitlab
|
|
78
80
|
report['failure_issue'] = new_failure_issue
|
79
81
|
end
|
80
82
|
|
83
|
+
def quarantine?
|
84
|
+
# The value for 'quarantine' could be nil, a hash, a string,
|
85
|
+
# or true (if the test just has the :quarantine tag)
|
86
|
+
# But any non-nil or false value should means the test is in quarantine
|
87
|
+
report['quarantine'].present?
|
88
|
+
end
|
89
|
+
|
81
90
|
private
|
82
91
|
|
83
92
|
# rubocop:disable Metrics/AbcSize
|
@@ -85,7 +85,8 @@ module Gitlab
|
|
85
85
|
'JIRA_ADMIN_USERNAME' => :jira_admin_username,
|
86
86
|
'JIRA_ADMIN_PASSWORD' => :jira_admin_password,
|
87
87
|
'CACHE_NAMESPACE_NAME' => :cache_namespace_name,
|
88
|
-
'DEPLOY_VERSION' => :deploy_version
|
88
|
+
'DEPLOY_VERSION' => :deploy_version,
|
89
|
+
'GITLAB_QA_USER_AGENT' => :gitlab_qa_user_agent
|
89
90
|
}.freeze
|
90
91
|
|
91
92
|
ENV_VARIABLES.each do |env_name, method_name|
|
@@ -135,8 +136,12 @@ module Gitlab
|
|
135
136
|
ENV['CI_PIPELINE_ID']
|
136
137
|
end
|
137
138
|
|
138
|
-
def
|
139
|
-
ENV['
|
139
|
+
def ci_project_id
|
140
|
+
ENV['CI_PROJECT_ID']
|
141
|
+
end
|
142
|
+
|
143
|
+
def ci_commit_ref_name
|
144
|
+
ENV['CI_COMMIT_REF_NAME']
|
140
145
|
end
|
141
146
|
|
142
147
|
def pipeline_from_project_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: 6.
|
4
|
+
version: 6.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Bizon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 4.
|
145
|
+
version: 4.16.1
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 4.
|
152
|
+
version: 4.16.1
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: http
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|