gitlab_quality-test_tooling 0.6.0 → 0.6.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: dbf155d73f05905e7650ae5660238042126c7eb4db61207882eca9dde123bc3c
4
- data.tar.gz: 9f09da32ac58114050a29e6d1394cea9b9e10dec024b2d6ec99137826e2927cb
3
+ metadata.gz: 80c8edb6daa8bf924d294ef291d82fd60c8545898aaa0eac7e71b98dad4dc1c2
4
+ data.tar.gz: 9e414922f797ce645e951f3fc26adb394a7a7f48f2c01bf7ddd7d218a1229486
5
5
  SHA512:
6
- metadata.gz: 6f2957b97fe89cfa6d18339f7b6b9ab00aa74d2677c0a957ec241c874b8ad69d5ee99470c3468b4ae23f239fbad3f2618cdba8499aa3548e0726884a6c688e66
7
- data.tar.gz: 4abb3047a022e643314ae67a51bddfdb7c6c2d96034b2a1197cd8419e00142218d729ffad5d2506b4efd9c7a2d8617bbf2c828521733db1c9c3af0a813baea76
6
+ metadata.gz: 573774ab0d7be7d23d2c262f0246377b824604240930ba451b088af914e7b166b8844e63425f3583a16f45bdc73be3779e5e5eb081218ff934fcb2e87698a8bf
7
+ data.tar.gz: f0ad9eb31e28e2c9f21c317b6d84e78645c36f5fff30baa8ada905d17f202710e087125a373f8fc38dd06612c08764839d2a35aaa835d133211219ee2778c37a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (0.6.0)
4
+ gitlab_quality-test_tooling (0.6.2)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.19)
7
7
  http (~> 5.0)
data/README.md CHANGED
@@ -80,7 +80,7 @@ Purpose: Relate test failures to failure issues from RSpec report files (JSON or
80
80
  Usage: exe/relate-failure-issue [options]
81
81
  -i, --input-files INPUT_FILES RSpec report files (JSON or JUnit XML)
82
82
  --max-diff-ratio MAX_DIFF_RATO
83
- Max stacktrace diff ratio for QA failure issues detection
83
+ Max stacktrace diff ratio for failure issues detection
84
84
  -p, --project PROJECT Can be an integer or a group/project string
85
85
  -t, --token TOKEN A valid access token with `api` scope and Maintainer permission in PROJECT
86
86
  --system-log-files SYSTEM_LOG_FILES
@@ -15,7 +15,7 @@ options = OptionParser.new do |opts|
15
15
  params[:input_files] = input_files
16
16
  end
17
17
 
18
- opts.on('--max-diff-ratio MAX_DIFF_RATO', Float, 'Max stacktrace diff ratio for QA failure issues detection') do |max_diff_ratio|
18
+ opts.on('--max-diff-ratio MAX_DIFF_RATO', Float, 'Max stacktrace diff ratio for failure issues detection') do |max_diff_ratio|
19
19
  params[:max_diff_ratio] = max_diff_ratio
20
20
  end
21
21
 
@@ -153,7 +153,7 @@ module GitlabQuality
153
153
  slack_options = {
154
154
  slack_webhook_url: ENV.fetch('CI_SLACK_WEBHOOK_URL', nil),
155
155
  channel: channel,
156
- username: "GitLab QA Bot",
156
+ username: "GitLab Quality Test Tooling",
157
157
  icon_emoji: ':ci_failing:',
158
158
  message: <<~MSG
159
159
  An unexpected error occurred while reporting test results in issues.
@@ -25,7 +25,7 @@ module GitlabQuality
25
25
  FAILED_JOB_DESCRIPTION_REGEX = %r{First happened in https?://\S+\.}m
26
26
  FAILED_JOB_NOTE_REGEX = %r{Failed most recently in \D+ pipeline: https?://\S+}
27
27
  NEW_ISSUE_LABELS = Set.new(%w[test failure::new priority::2]).freeze
28
- IGNORE_EXCEPTIONS = ['Net::ReadTimeout'].freeze
28
+ IGNORE_EXCEPTIONS = ['Net::ReadTimeout', '403 Forbidden - Your account has been blocked'].freeze
29
29
  SCREENSHOT_IGNORED_ERRORS = ['500 Internal Server Error', 'fabricate_via_api!', 'Error Code 500'].freeze
30
30
 
31
31
  MultipleIssuesFound = Class.new(StandardError)
@@ -118,10 +118,10 @@ module GitlabQuality
118
118
  end
119
119
 
120
120
  def pipeline_issues_with_similar_stacktrace(test)
121
- gitlab.find_issues(options: { state: 'opened', labels: (base_issue_labels + %w[failure::new]).join(','),
121
+ gitlab.find_issues(options: { state: 'opened', labels: (base_issue_labels + %w[test failure::new]).join(','),
122
122
  created_after: past_timestamp(2) }).select do |issue|
123
123
  job_url_from_issue = failed_issue_job_url(issue)
124
- next unless pipeline == pipeline_env_from_job_url(job_url_from_issue)
124
+ next if pipeline != pipeline_env_from_job_url(job_url_from_issue)
125
125
 
126
126
  stack_trace_from_issue = cleaned_stack_trace_from_issue(issue)
127
127
  stack_trace_from_test = cleaned_stacktrace_from_test(test)
@@ -153,7 +153,7 @@ module GitlabQuality
153
153
  if job_url.include?('/quality/')
154
154
  job_url.partition('/quality/').last.partition('/').first
155
155
  else
156
- 'master'
156
+ Runtime::Env.default_branch
157
157
  end
158
158
  end
159
159
 
@@ -163,7 +163,7 @@ module GitlabQuality
163
163
  end
164
164
 
165
165
  def failure_issues(test)
166
- gitlab.find_issues(options: { state: 'opened', labels: 'QA' }).select do |issue|
166
+ gitlab.find_issues(options: { state: 'opened', labels: base_issue_labels + %w[test] }).select do |issue|
167
167
  issue_title = issue.title.strip
168
168
  issue_title.include?(test.name) || issue_title.include?(partial_file_path(test.file))
169
169
  end
@@ -202,7 +202,7 @@ module GitlabQuality
202
202
 
203
203
  def find_relevant_failure_issues(test) # rubocop:disable Metrics/AbcSize
204
204
  clean_first_test_failure_stacktrace = cleaned_stacktrace_from_test(test)
205
- # Search with the `search` param returns 500 errors, so we filter by ~QA and then filter further in Ruby
205
+ # Search with the `search` param returns 500 errors, so we filter by `base_issue_labels` and then filter further in Ruby
206
206
  failure_issues(test).each_with_object({}) do |issue, memo|
207
207
  clean_relevant_issue_stacktrace = cleaned_stack_trace_from_issue(issue)
208
208
  next if clean_relevant_issue_stacktrace.nil?
@@ -370,13 +370,13 @@ module GitlabQuality
370
370
  # @param [Array<Hash>] exceptions the exceptions associated with the failure.
371
371
  # @return [String] the reason to ignore the exceptions, or `nil` if any exceptions should not be ignored.
372
372
  def ignore_failure_reason(exceptions)
373
- exception_classes = exceptions
374
- .filter_map { |exception| exception['class'] if IGNORE_EXCEPTIONS.include?(exception['class']) }
373
+ exception_messages = exceptions
374
+ .filter_map { |exception| exception['message'] if IGNORE_EXCEPTIONS.any? { |e| exception['message'].include?(e) } }
375
375
  .compact
376
- return if exception_classes.empty? || exception_classes.size < exceptions.size
376
+ return if exception_messages.empty? || exception_messages.size < exceptions.size
377
377
 
378
- msg = exception_classes.many? ? 'the errors were' : 'the error was'
379
- "#{msg} #{exception_classes.join(', ')}"
378
+ msg = exception_messages.many? ? 'the errors were' : 'the error was'
379
+ "#{msg} #{exception_messages.join(', ')}"
380
380
  end
381
381
  end
382
382
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_quality-test_tooling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.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: 2023-05-30 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control