gitlab-qa 7.7.1 → 7.8.1
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/lib/gitlab/qa/report/generate_test_session.rb +1 -1
- data/lib/gitlab/qa/report/gitlab_issue_client.rb +3 -3
- data/lib/gitlab/qa/report/gitlab_issue_dry_client.rb +2 -2
- data/lib/gitlab/qa/report/relate_failure_issue.rb +2 -2
- data/lib/gitlab/qa/report/report_as_issue.rb +7 -6
- data/lib/gitlab/qa/report/results_in_issues.rb +109 -25
- data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +2 -3
- 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: 3d5db8c8b0acf394172a0def237d3049c42c04a811204589d6052fb3fda32eb2
|
4
|
+
data.tar.gz: ae97cccc20dce22ce593a1d5a9690d6375b68fcd8ca1d2c4f854803c92dc17d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f13f3e88a045994996a2664e0efedc7dadac3ac53e7cd52b0338cf95b33224bd28d92dbe1909dd0ba66f60b4de1b41dd407c1fd1604b72b295c9368a8526710
|
7
|
+
data.tar.gz: aed74598a8cb77c86822ceb2dc457641e4092aa764dba0bbcb3cd281d4a85abe329a8ecda6670e325655afd0470730b9e7699f5be5b0517dec66866f7adcca04
|
@@ -196,7 +196,7 @@ module Gitlab
|
|
196
196
|
if testcase && !passed
|
197
197
|
# Workaround for reducing system notes on testcase issues
|
198
198
|
# The first regex extracts the link to the issues list page from a link to a single issue show page by removing the issue id.
|
199
|
-
"[#{text}](#{testcase.match(%r{[\s\S]+\/[^\/\d]+})}?state=opened&search=#{encoded_text})
|
199
|
+
"[#{text}](#{testcase.match(%r{[\s\S]+\/[^\/\d]+})}?state=opened&search=#{encoded_text})"
|
200
200
|
else
|
201
201
|
text
|
202
202
|
end
|
@@ -49,7 +49,7 @@ module Gitlab
|
|
49
49
|
select ||= :itself
|
50
50
|
|
51
51
|
handle_gitlab_client_exceptions do
|
52
|
-
return [Gitlab.issue(project, iid)] if iid
|
52
|
+
return [Gitlab.issue(project, iid)].select(&select) if iid
|
53
53
|
|
54
54
|
Gitlab.issues(project, options)
|
55
55
|
.auto_paginate
|
@@ -63,8 +63,8 @@ module Gitlab
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def create_issue(title:, description:, labels:)
|
67
|
-
attrs = { description: description, labels: labels }
|
66
|
+
def create_issue(title:, description:, labels:, issue_type: 'issue')
|
67
|
+
attrs = { issue_type: issue_type, description: description, labels: labels }
|
68
68
|
|
69
69
|
handle_gitlab_client_exceptions do
|
70
70
|
Gitlab.create_issue(project, title, attrs)
|
@@ -4,10 +4,10 @@ module Gitlab
|
|
4
4
|
module QA
|
5
5
|
module Report
|
6
6
|
class GitlabIssueDryClient < GitlabIssueClient
|
7
|
-
def create_issue(title:, description:, labels:)
|
7
|
+
def create_issue(title:, description:, labels:, issue_type: 'issue')
|
8
8
|
attrs = { description: description, labels: labels }
|
9
9
|
|
10
|
-
puts "The following
|
10
|
+
puts "The following #{issue_type} would have been created:"
|
11
11
|
puts "project: #{project}, title: #{title}, attrs: #{attrs}"
|
12
12
|
end
|
13
13
|
|
@@ -150,10 +150,10 @@ module Gitlab
|
|
150
150
|
end
|
151
151
|
|
152
152
|
def new_issue_labels(test)
|
153
|
-
|
153
|
+
up_to_date_labels(test: test, new_labels: NEW_ISSUE_LABELS)
|
154
154
|
end
|
155
155
|
|
156
|
-
def up_to_date_labels(test:, issue: nil)
|
156
|
+
def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
|
157
157
|
super << pipeline_name_label
|
158
158
|
end
|
159
159
|
|
@@ -88,17 +88,18 @@ module Gitlab
|
|
88
88
|
issue&.labels&.to_set || Set.new
|
89
89
|
end
|
90
90
|
|
91
|
-
def update_labels(issue, test)
|
92
|
-
|
91
|
+
def update_labels(issue, test, new_labels = Set.new)
|
92
|
+
labels = up_to_date_labels(test: test, issue: issue, new_labels: new_labels)
|
93
93
|
|
94
|
-
return if issue_labels(issue) ==
|
94
|
+
return if issue_labels(issue) == labels
|
95
95
|
|
96
|
-
gitlab.edit_issue(iid: issue.iid, options: { labels:
|
96
|
+
gitlab.edit_issue(iid: issue.iid, options: { labels: labels.to_a })
|
97
97
|
end
|
98
98
|
|
99
|
-
def up_to_date_labels(test:, issue: nil)
|
99
|
+
def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
|
100
100
|
labels = issue_labels(issue)
|
101
|
-
labels
|
101
|
+
labels |= new_labels
|
102
|
+
ee_test?(test) ? labels << "Enterprise Edition" : labels.delete("Enterprise Edition")
|
102
103
|
quarantine_job? ? labels << "quarantine" : labels.delete("quarantine")
|
103
104
|
|
104
105
|
labels
|
@@ -10,6 +10,8 @@ module Gitlab
|
|
10
10
|
class ResultsInIssues < ReportAsIssue
|
11
11
|
private
|
12
12
|
|
13
|
+
RESULTS_SECTION_TEMPLATE = "\n\n### DO NOT EDIT BELOW THIS LINE\n\nActive and historical test results:"
|
14
|
+
|
13
15
|
def run!
|
14
16
|
puts "Reporting test results in `#{files.join(',')}` as issues in project `#{project}` via the API at `#{Runtime::Env.gitlab_api_base}`."
|
15
17
|
|
@@ -17,7 +19,7 @@ module Gitlab
|
|
17
19
|
puts "Reporting tests in #{test_results.path}"
|
18
20
|
|
19
21
|
test_results.each do |test|
|
20
|
-
report_test(test)
|
22
|
+
report_test(test) unless test.skipped
|
21
23
|
end
|
22
24
|
|
23
25
|
test_results.write
|
@@ -27,56 +29,138 @@ module Gitlab
|
|
27
29
|
def report_test(test)
|
28
30
|
puts "Reporting test: #{test.file} | #{test.name}"
|
29
31
|
|
30
|
-
|
32
|
+
testcase = find_testcase(test) || create_testcase(test)
|
33
|
+
test.testcase ||= testcase.web_url.sub('/issues/', '/quality/test_cases/')
|
34
|
+
|
35
|
+
issue = find_issue_by_iid(testcase, test)
|
36
|
+
|
37
|
+
unless issue
|
38
|
+
puts "No valid issue link found"
|
39
|
+
issue = find_or_create_issue(test)
|
40
|
+
|
41
|
+
add_issue_to_testcase(testcase, issue)
|
42
|
+
puts "Added issue #{issue.web_url} to testcase #{testcase.web_url}"
|
43
|
+
end
|
44
|
+
|
45
|
+
update_labels(testcase, test)
|
46
|
+
update_issue(issue, test)
|
47
|
+
end
|
48
|
+
|
49
|
+
def find_testcase(test)
|
50
|
+
iid = iid_from_testcase_url(test.testcase)
|
51
|
+
|
52
|
+
testcases = search_issues(test: test, issue_type: 'test_case', iid: iid)
|
53
|
+
|
54
|
+
if iid && testcases.blank?
|
55
|
+
warn(%(Test case url "#{test.testcase}" not valid))
|
56
|
+
testcases = search_issues(test: test, issue_type: 'test_case')
|
57
|
+
end
|
58
|
+
|
59
|
+
warn(%(Too many test cases found with the file path "#{test.file}" and name "#{test.name}")) if testcases&.many?
|
60
|
+
|
61
|
+
testcases.first
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_testcase(test)
|
65
|
+
title = title_from_test(test)
|
66
|
+
puts "Creating test case '#{title}' ..."
|
67
|
+
|
68
|
+
gitlab.create_issue(
|
69
|
+
title: title,
|
70
|
+
description: new_testcase_description(test),
|
71
|
+
labels: new_issue_labels(test),
|
72
|
+
issue_type: 'test_case'
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
def iid_from_testcase_url(url)
|
77
|
+
return warn(%(\nPlease update #{url} to test case url")) if url&.include?('/-/issues/')
|
78
|
+
|
79
|
+
url && url.split('/').last.to_i
|
80
|
+
end
|
81
|
+
|
82
|
+
def new_testcase_description(test)
|
83
|
+
"#{new_issue_description(test)}#{RESULTS_SECTION_TEMPLATE}"
|
84
|
+
end
|
85
|
+
|
86
|
+
def issue_iid_from_testcase(testcase)
|
87
|
+
results = testcase.description.partition(RESULTS_SECTION_TEMPLATE).last if testcase.description.include?(RESULTS_SECTION_TEMPLATE)
|
88
|
+
|
89
|
+
return puts "No issue link found" unless results
|
90
|
+
|
91
|
+
issue_iid = results.split('/').last
|
92
|
+
|
93
|
+
issue_iid&.to_i
|
94
|
+
end
|
95
|
+
|
96
|
+
def find_or_create_issue(test)
|
97
|
+
issue = find_issue(test, 'issue')
|
31
98
|
|
32
99
|
if issue
|
33
100
|
puts "Found existing issue: #{issue.web_url}"
|
34
101
|
else
|
35
|
-
# Don't create new issues for skipped tests
|
36
|
-
return if test.skipped
|
37
|
-
|
38
102
|
issue = create_issue(test)
|
39
103
|
puts "Created new issue: #{issue.web_url}"
|
40
104
|
end
|
41
105
|
|
42
|
-
|
106
|
+
issue
|
107
|
+
end
|
43
108
|
|
44
|
-
|
45
|
-
|
109
|
+
def find_issue_by_iid(testcase, test)
|
110
|
+
iid = issue_iid_from_testcase(testcase)
|
46
111
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
112
|
+
return unless iid
|
113
|
+
|
114
|
+
issues = search_issues(test: test, issue_type: 'issue', iid: iid)
|
115
|
+
|
116
|
+
warn(%(Issue iid "#{iid}" not valid)) if issues.empty?
|
117
|
+
|
118
|
+
issues.first
|
52
119
|
end
|
53
120
|
|
54
|
-
def find_issue(test)
|
55
|
-
|
56
|
-
issues =
|
57
|
-
gitlab.find_issues(
|
58
|
-
iid: iid_from_testcase_url(test.testcase),
|
59
|
-
options: { search: search_term(test) }) do |issue|
|
60
|
-
issue.state == 'opened' && issue.title.strip == title
|
61
|
-
end
|
121
|
+
def find_issue(test, issue_type)
|
122
|
+
issues = search_issues(test: test, issue_type: 'issue')
|
62
123
|
|
63
124
|
warn(%(Too many issues found with the file path "#{test.file}" and name "#{test.name}")) if issues.many?
|
64
125
|
|
65
126
|
issues.first
|
66
127
|
end
|
67
128
|
|
129
|
+
def add_issue_to_testcase(testcase, issue)
|
130
|
+
results_section = testcase.description.include?(RESULTS_SECTION_TEMPLATE) ? '' : RESULTS_SECTION_TEMPLATE
|
131
|
+
|
132
|
+
gitlab.edit_issue(iid: testcase.iid, options: { description: (testcase.description + results_section + "\n\n#{issue.web_url}") })
|
133
|
+
end
|
134
|
+
|
135
|
+
def update_issue(issue, test)
|
136
|
+
new_labels = issue_labels(issue)
|
137
|
+
new_labels |= ['Testcase Linked']
|
138
|
+
|
139
|
+
labels_updated = update_labels(issue, test, new_labels)
|
140
|
+
note_posted = note_status(issue, test)
|
141
|
+
|
142
|
+
if labels_updated || note_posted
|
143
|
+
puts "Issue updated."
|
144
|
+
else
|
145
|
+
puts "Test passed, no update needed."
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
68
149
|
def new_issue_labels(test)
|
69
|
-
|
150
|
+
['Quality', "devops::#{test.stage}", 'status::automated']
|
70
151
|
end
|
71
152
|
|
72
|
-
def up_to_date_labels(test:, issue: nil)
|
153
|
+
def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
|
73
154
|
labels = super
|
155
|
+
labels |= new_issue_labels(test).to_set
|
74
156
|
labels.delete_if { |label| label.start_with?("#{pipeline}::") }
|
75
157
|
labels << (test.failures.empty? ? "#{pipeline}::passed" : "#{pipeline}::failed")
|
76
158
|
end
|
77
159
|
|
78
|
-
def
|
79
|
-
|
160
|
+
def search_issues(test:, issue_type:, iid: nil)
|
161
|
+
gitlab.find_issues(iid: iid, options: { search: search_term(test) }) do |issue|
|
162
|
+
issue.state == 'opened' && issue.issue_type == issue_type && issue.title.strip == title_from_test(test)
|
163
|
+
end
|
80
164
|
end
|
81
165
|
|
82
166
|
def search_term(test)
|
@@ -107,9 +107,8 @@ module Gitlab
|
|
107
107
|
praefect['database_password'] = 'SQL_PASSWORD';
|
108
108
|
praefect['database_dbname'] = 'praefect_production';
|
109
109
|
praefect['database_sslmode'] = 'disable';
|
110
|
-
praefect['
|
111
|
-
praefect['
|
112
|
-
praefect['failover_election_strategy'] = 'per_repository';
|
110
|
+
praefect['database_direct_host'] = '#{@database}.#{@network}';
|
111
|
+
praefect['database_direct_port'] = 5432;
|
113
112
|
praefect['virtual_storages'] = {
|
114
113
|
'default' => {
|
115
114
|
'nodes' => {
|
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.
|
4
|
+
version: 7.8.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: 2021-
|
11
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|