gitlab-qa 7.8.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c415d54da820d67fa1544a1ffaefaf913f27090c6c07fa1f06c02797bd8756d3
4
- data.tar.gz: 43ad1f640c478c666658e503fa84b77e9a3bcfaa5c69d7d5d2ae4151e34c7adc
3
+ metadata.gz: c8e6f385001950cb2511426d82a6acac3c3615683b8dbd48214df976c6fb07d5
4
+ data.tar.gz: 51de85c6c9c5dca24ba24961d45005d9ff2bbe168d7a8819f54ee6412ab0abcd
5
5
  SHA512:
6
- metadata.gz: bce89411537a6398b5168ecd32bbea3e8996173e07ef16bd4142c70e3c9cdf14110fe7d1b9dd35feaae37809068e255ced355d804c331a0f43431b47de92f787
7
- data.tar.gz: 6c159684288d094f6266ea427f6320611b724f823f8ebab216a5139817c047fc1c99602b742a51d9467b38348f89d628b2995ea81ad722ed2229d6d089d0952a
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 = find_issue_by_iid(testcase, test)
35
+ issue = find_linked_results_issue_by_iid(testcase, test)
36
36
 
37
- unless issue
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 = find_or_create_issue(test)
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
- iid = iid_from_testcase_url(test.testcase)
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
- testcases = search_issues(test: test, issue_type: 'test_case', iid: iid)
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
- if iid && testcases.blank?
55
- warn(%(Test case url "#{test.testcase}" not valid))
56
- testcases = search_issues(test: test, issue_type: 'test_case')
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(%(Too many test cases found with the file path "#{test.file}" and name "#{test.name}")) if testcases&.many?
83
+ warn(%(#{issue_type} iid "#{iid}" not valid)) if issues.empty?
60
84
 
61
- testcases.first
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 iid_from_testcase_url(url)
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 find_or_create_issue(test)
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 = search_issues(test: test, issue_type: 'issue')
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 issues found with the file path "#{test.file}" and name "#{test.name}")) if issues.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
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '7.8.3'.freeze
3
+ VERSION = '7.8.4'.freeze
4
4
  end
5
5
  end
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.3
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-03 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control