gitlab-qa 7.8.3 → 7.8.4
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 +2 -0
- data/lib/gitlab/qa/report/results_in_issues.rb +51 -35
- 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:
|
@@ -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,18 +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)
|
51
64
|
|
52
|
-
|
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)
|
53
72
|
|
54
|
-
|
55
|
-
|
56
|
-
|
73
|
+
return unless iid
|
74
|
+
|
75
|
+
find_issue_by_iid(iid, 'issue')
|
76
|
+
end
|
77
|
+
|
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
|
57
81
|
end
|
58
82
|
|
59
|
-
warn(%(
|
83
|
+
warn(%(#{issue_type} iid "#{iid}" not valid)) if issues.empty?
|
60
84
|
|
61
|
-
|
85
|
+
issues.first
|
86
|
+
end
|
87
|
+
|
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) })
|
62
92
|
end
|
63
93
|
|
64
94
|
def create_testcase(test)
|
@@ -73,7 +103,7 @@ module Gitlab
|
|
73
103
|
)
|
74
104
|
end
|
75
105
|
|
76
|
-
def
|
106
|
+
def testcase_iid_from_url(url)
|
77
107
|
return warn(%(\nPlease update #{url} to test case url")) if url&.include?('/-/issues/')
|
78
108
|
|
79
109
|
url && url.split('/').last.to_i
|
@@ -93,7 +123,7 @@ module Gitlab
|
|
93
123
|
issue_iid&.to_i
|
94
124
|
end
|
95
125
|
|
96
|
-
def
|
126
|
+
def find_or_create_results_issue(test)
|
97
127
|
issue = find_issue(test, 'issue')
|
98
128
|
|
99
129
|
if issue
|
@@ -106,22 +136,12 @@ module Gitlab
|
|
106
136
|
issue
|
107
137
|
end
|
108
138
|
|
109
|
-
def find_issue_by_iid(testcase, test)
|
110
|
-
iid = issue_iid_from_testcase(testcase)
|
111
|
-
|
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
|
119
|
-
end
|
120
|
-
|
121
139
|
def find_issue(test, issue_type)
|
122
|
-
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
|
123
143
|
|
124
|
-
warn(%(Too many
|
144
|
+
warn(%(Too many #{issue_type}s found with the file path "#{test.file}" and name "#{test.name}")) if issues.many?
|
125
145
|
|
126
146
|
issues.first
|
127
147
|
end
|
@@ -130,6 +150,8 @@ module Gitlab
|
|
130
150
|
results_section = testcase.description.include?(RESULTS_SECTION_TEMPLATE) ? '' : RESULTS_SECTION_TEMPLATE
|
131
151
|
|
132
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}"
|
133
155
|
end
|
134
156
|
|
135
157
|
def update_issue(issue, test)
|
@@ -157,12 +179,6 @@ module Gitlab
|
|
157
179
|
labels << (test.failures.empty? ? "#{pipeline}::passed" : "#{pipeline}::failed")
|
158
180
|
end
|
159
181
|
|
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
|
164
|
-
end
|
165
|
-
|
166
182
|
def search_term(test)
|
167
183
|
%("#{partial_file_path(test.file)}" "#{search_safe(test.name)}")
|
168
184
|
end
|
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-09-
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|