gitlab-qa 8.10.1 → 8.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81e48c81786f8f96655e3c8096e804cf08b1ca602133fb10b3238d581df26957
4
- data.tar.gz: faf446327a9eba30bb029771ca8658097da2b3852a4389fe1d3309cf370c037f
3
+ metadata.gz: ce6a96929be3b7acd00c732df6b26ed29a4cc408644476d21c1958bb975ee939
4
+ data.tar.gz: 6a20e2991f73d98592a07acd6784a7f859428ffabdba8978efd323b323dc16ff
5
5
  SHA512:
6
- metadata.gz: ee989bb53b1fae1ff3ab34780f20b8cb609cb23aee4d74ec04d2b7f31aeae78d136157044009e79fa53084f9edb168c69150596fedab77670385b5e56803138c
7
- data.tar.gz: 1d3355039191667d8415097781afc5f49294e4c0fe9c10407c92537085ee088e642cf167518e2a4688faeb4410f20c7e2cc9e70d7d6bd0c05539fbd0667f43c1
6
+ metadata.gz: 28919be695aed93cf5e6386be79a5dd5b94635a2f691f4f8eff7fe3766ce1ee4ad1e630307bf1f77b2cff93f3b8237f999081735aede83924e23b9b451aa5c0a
7
+ data.tar.gz: 2d3f278b76595ed49d83507295042657cd4c2dc4d853ced19f466b6cb146dee6e23c30ec071af36e0a546109331c2a3938bb40cbe825059be482043550be2380
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (8.10.1)
4
+ gitlab-qa (8.10.2)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
@@ -16,6 +16,7 @@ module Gitlab
16
16
  FAILURE_STACKTRACE_REGEX = %r{((.*Failure\/Error:(?<stacktrace>.+))|(?<stacktrace>.+))}m.freeze
17
17
  ISSUE_STACKTRACE_REGEX = /### Stack trace\s*(```)#{FAILURE_STACKTRACE_REGEX}(```)/m.freeze
18
18
  NEW_ISSUE_LABELS = Set.new(%w[QA Quality test failure::new priority::2]).freeze
19
+ IGNORE_EXCEPTIONS = ['Net::ReadTimeout'].freeze
19
20
 
20
21
  MultipleIssuesFound = Class.new(StandardError)
21
22
 
@@ -37,9 +38,7 @@ module Gitlab
37
38
  puts "=> Reporting tests in #{test_results.path}"
38
39
 
39
40
  test_results.each do |test|
40
- next if test.failures.empty?
41
-
42
- relate_failure_to_issue(test)
41
+ relate_failure_to_issue(test) if should_report?(test)
43
42
  end
44
43
 
45
44
  test_results.write
@@ -90,7 +89,7 @@ module Gitlab
90
89
  end
91
90
 
92
91
  def full_stacktrace(test)
93
- if test.failures.first['message_lines'].empty?
92
+ if test.failures.first['message_lines'].empty? || test.failures.first['message_lines'].instance_of?(String)
94
93
  test.failures.first['message']
95
94
  else
96
95
  test.failures.first['message_lines'].join("\n")
@@ -234,6 +233,40 @@ module Gitlab
234
233
  puts " => No product group metadata found for test '#{test.name}'"
235
234
  end
236
235
  end
236
+
237
+ # Checks if a test failure should be reported.
238
+ #
239
+ # @return [Boolean] false if the test was skipped or failed because of a transient error that can be ignored.
240
+ # Otherwise returns true.
241
+ def should_report?(test)
242
+ return false if test.failures.empty?
243
+
244
+ if test.report.key?('exceptions')
245
+ reason = ignore_failure_reason(test.report['exceptions'])
246
+
247
+ if reason
248
+ puts "Failure reporting skipped because #{reason}"
249
+
250
+ return false
251
+ end
252
+ end
253
+
254
+ true
255
+ end
256
+
257
+ # Determine any reason to ignore a failure.
258
+ #
259
+ # @param [Array<Hash>] exceptions the exceptions associated with the failure.
260
+ # @return [String] the reason to ignore the exceptions, or `nil` if any exceptions should not be ignored.
261
+ def ignore_failure_reason(exceptions)
262
+ exception_classes = exceptions
263
+ .filter_map { |exception| exception['class'] if IGNORE_EXCEPTIONS.include?(exception['class']) }
264
+ .compact
265
+ return if exception_classes.empty? || exception_classes.size < exceptions.size
266
+
267
+ msg = exception_classes.many? ? 'the errors were' : 'the error was'
268
+ "#{msg} #{exception_classes.join(', ')}"
269
+ end
237
270
  end
238
271
  end
239
272
  end
@@ -7,8 +7,6 @@ module Gitlab
7
7
  class ReportResults < ReportAsIssue
8
8
  attr_accessor :testcase_project_reporter, :results_issue_project_reporter, :files, :test_case_project, :results_issue_project, :gitlab
9
9
 
10
- IGNORE_EXCEPTIONS = ['Net::ReadTimeout'].freeze
11
-
12
10
  def initialize(token:, input_files:, test_case_project: nil, results_issue_project: nil, dry_run: false, **kwargs)
13
11
  @testcase_project_reporter = Gitlab::QA::Report::ResultsInTestCases.new(token: token, input_files: input_files, project: test_case_project, dry_run: dry_run, **kwargs)
14
12
  @results_issue_project_reporter = Gitlab::QA::Report::ResultsInIssues.new(token: token, input_files: input_files, project: results_issue_project, dry_run: dry_run, **kwargs)
@@ -24,6 +22,7 @@ module Gitlab
24
22
  abort "Please provide valid project IDs or paths with the `--results-issue-project` and `--test-case-project` options!"
25
23
  end
26
24
 
25
+ # rubocop:disable Metrics/AbcSize
27
26
  def run!
28
27
  puts "Reporting test results in `#{files.join(',')}` as test cases in project `#{test_case_project}`"\
29
28
  " and issues in project `#{results_issue_project}` via the API at `#{Runtime::Env.gitlab_api_base}`."
@@ -32,14 +31,17 @@ module Gitlab
32
31
  puts "Reporting tests in #{test_results.path}"
33
32
 
34
33
  test_results.each do |test|
34
+ next if test.file.include?('/features/sanity/') || test.skipped
35
+
35
36
  puts "Reporting test: #{test.file} | #{test.name}\n"
36
37
 
37
- report_test(test) if should_report?(test)
38
+ report_test(test)
38
39
  end
39
40
 
40
41
  test_results.write
41
42
  end
42
43
  end
44
+ # rubocop:enable Metrics/AbcSize
43
45
 
44
46
  private
45
47
 
@@ -56,40 +58,6 @@ module Gitlab
56
58
  testcase_project_reporter.update_testcase(testcase, test)
57
59
  results_issue_project_reporter.update_issue(issue, test)
58
60
  end
59
-
60
- # Checks if a test result should be reported.
61
- #
62
- # @return [Boolean] false if the test was skipped or failed because of a transient error that can be ignored.
63
- # Otherwise returns true.
64
- def should_report?(test)
65
- return false if test.skipped
66
-
67
- if test.report.key?('exceptions')
68
- reason = ignore_failure_reason(test.report['exceptions'])
69
-
70
- if reason
71
- puts "Issue update skipped because #{reason}"
72
-
73
- return false
74
- end
75
- end
76
-
77
- true
78
- end
79
-
80
- # Determine any reason to ignore a failure.
81
- #
82
- # @param [Array<Hash>] exceptions the exceptions associated with the failure.
83
- # @return [String] the reason to ignore the exceptions, or `nil` if any exceptions should not be ignored.
84
- def ignore_failure_reason(exceptions)
85
- exception_classes = exceptions
86
- .filter_map { |exception| exception['class'] if IGNORE_EXCEPTIONS.include?(exception['class']) }
87
- .compact
88
- return if exception_classes.empty? || exception_classes.size < exceptions.size
89
-
90
- msg = exception_classes.many? ? 'the errors were' : 'the error was'
91
- "#{msg} #{exception_classes.join(', ')}"
92
- end
93
61
  end
94
62
  end
95
63
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '8.10.1'
5
+ VERSION = '8.10.2'
6
6
  end
7
7
  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: 8.10.1
4
+ version: 8.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-31 00:00:00.000000000 Z
11
+ date: 2022-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control