gitlab-qa 8.10.0 → 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: f953400de439363c7574e32bc75e4dfe90a51223708bb57c38c268e591b57bc8
4
- data.tar.gz: fa43874f0bfd3e8524ab496bf44ea21b67dd42a8cecc532a6d020050603c3a2a
3
+ metadata.gz: ce6a96929be3b7acd00c732df6b26ed29a4cc408644476d21c1958bb975ee939
4
+ data.tar.gz: 6a20e2991f73d98592a07acd6784a7f859428ffabdba8978efd323b323dc16ff
5
5
  SHA512:
6
- metadata.gz: fc7a630d56deab744601fe176c17c52fdec1073701b990118eb7a11068e44faa65f068de470b1c340b8bca9fd4fc2d61fa82f980be84f8fd4c6c405799bfefe7
7
- data.tar.gz: c5638a094566d7b27cf24a0d6ec4a7eebfcee7c8e26df7c5ea32d86a3944b3d6b59ec9f4ce768c20206bb743b8a6bd477521e6d4832f97fa005cd193fb23b43b
6
+ metadata.gz: 28919be695aed93cf5e6386be79a5dd5b94635a2f691f4f8eff7fe3766ce1ee4ad1e630307bf1f77b2cff93f3b8237f999081735aede83924e23b9b451aa5c0a
7
+ data.tar.gz: 2d3f278b76595ed49d83507295042657cd4c2dc4d853ced19f466b6cb146dee6e23c30ec071af36e0a546109331c2a3938bb40cbe825059be482043550be2380
@@ -4,7 +4,7 @@ stages:
4
4
  - notify
5
5
 
6
6
  default:
7
- image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-ruby-2.7
7
+ image: registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.3-docker-${DOCKER_VERSION}
8
8
  tags:
9
9
  - gitlab-org
10
10
  cache:
@@ -12,6 +12,7 @@ default:
12
12
  files:
13
13
  - Gemfile.lock
14
14
  - gitlab-qa.gemspec
15
+ prefix: $RUBY_VERSION
15
16
  paths:
16
17
  - vendor/ruby
17
18
  before_script:
@@ -79,6 +80,8 @@ variables:
79
80
  QA_TESTCASE_SESSIONS_PROJECT: "gitlab-org/quality/testcase-sessions"
80
81
  # QA_DEFAULT_BRANCH is the default branch name of the instance under test.
81
82
  QA_DEFAULT_BRANCH: "master"
83
+ RUBY_VERSION: "2.7"
84
+ DOCKER_VERSION: "20.10.14"
82
85
 
83
86
  .ce-variables:
84
87
  variables:
@@ -32,4 +32,4 @@ with the latest commit from https://gitlab.com/gitlab-org/gitlab-qa/commits/mast
32
32
  - Checklist after merging:
33
33
  - [ ] [Update the release notes for the newly created tag](docs/release_process.md#how-to).
34
34
 
35
- /label ~Quality ~"type::maintenance"
35
+ /label ~Quality ~"type::maintenance" ~"maintenance::dependency"
data/.gitlab-ci.yml CHANGED
@@ -5,7 +5,7 @@ stages:
5
5
  - deploy
6
6
 
7
7
  default:
8
- image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-ruby-2.7
8
+ image: registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.3
9
9
  tags:
10
10
  - gitlab-org
11
11
  cache:
@@ -13,6 +13,7 @@ default:
13
13
  files:
14
14
  - Gemfile.lock
15
15
  - gitlab-qa.gemspec
16
+ prefix: $RUBY_VERSION
16
17
  paths:
17
18
  - vendor/ruby
18
19
  before_script:
@@ -40,16 +41,24 @@ workflow:
40
41
  # When using Run pipeline button in the GitLab UI, from the project’s CI/CD > Pipelines section, create a pipeline.
41
42
  - if: '$CI_PIPELINE_SOURCE == "web"'
42
43
 
44
+ variables:
45
+ RUBY_VERSION: "2.7"
46
+
43
47
  .check-base:
44
48
  stage: check
45
- script:
46
- - bundle exec $CI_JOB_NAME --color
49
+ parallel:
50
+ matrix:
51
+ - RUBY_VERSION: ["2.7", "3.0"]
47
52
 
48
53
  rubocop:
49
54
  extends: .check-base
55
+ script:
56
+ - bundle exec rubocop --color
50
57
 
51
58
  rspec:
52
59
  extends: .check-base
60
+ script:
61
+ - bundle exec rspec --force-color
53
62
 
54
63
  prepare:
55
64
  stage: generate
data/.rubocop.yml CHANGED
@@ -39,3 +39,7 @@ Layout/SpaceBeforeFirstArg:
39
39
 
40
40
  RSpec/MultipleMemoizedHelpers:
41
41
  Enabled: false
42
+
43
+ CodeReuse/ActiveRecord:
44
+ Exclude:
45
+ - 'spec/**/*_spec.rb'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (8.10.0)
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
@@ -32,7 +32,7 @@ module Gitlab
32
32
 
33
33
  logger.info("Shell command: `#{mask_secrets(command).cyan}`")
34
34
 
35
- Open3.popen2e(@command.to_s) do |stdin, out, wait|
35
+ Open3.popen2e(command.to_s) do |stdin, out, wait|
36
36
  if @stdin_data
37
37
  stdin.puts(@stdin_data)
38
38
  stdin.close
@@ -90,7 +90,7 @@ module Gitlab
90
90
  # @param [String] input the string to mask
91
91
  # @return [String] The masked string
92
92
  def mask_secrets(input)
93
- @mask_secrets.each_with_object(+input) { |secret, s| s.gsub!(secret, '*****') }.to_s
93
+ @mask_secrets.reduce(input) { |s, secret| s.gsub(secret, '*****') }.to_s
94
94
  end
95
95
  end
96
96
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '8.10.0'
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.0
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-28 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