gitlab_quality-test_tooling 1.8.0 → 1.8.1

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: 4ee3407afd5274be75c1bb63c7f7aeeb0d2353cf62f0fb75c1393bd2103c8c1e
4
- data.tar.gz: a4965dd9d979a58c4202c6f25315d60e08d597d51322db491a077a0ae797cf34
3
+ metadata.gz: 4c8eda4a61584293cfb2f20a4ece0c5afd8963be75c56c5c3a1f71cbbf04a2ed
4
+ data.tar.gz: 72ea08e5a2fac3b5d9f0d5dada3bb71c7b655acbd7c03f4533e0bbe951be954e
5
5
  SHA512:
6
- metadata.gz: 1619807ec2456f02c9d4a1c09dfb0aeba598de7d51fe7a0377c1e5a9f3f9fc82cf607fa34387bb5ee1691ad28b5637e75c18c38ce068269c3bba76e3c902df22
7
- data.tar.gz: '0940057d402dfb8fbcd3a6d2d09f7ff698e26d140ebdda659fcc5347445574fa7f398b2bd91e8a39c872b0f8a9f368fa1f734e59e10262790ed2d507fb97e514'
6
+ metadata.gz: fe64d9f93ff1343c36d1d478f63e9a4614587897b6414ec3a1f4c28fdd90ee1d245134e9350f546373350acf1f1355dd50d31da162a899d096ceb1114029767e
7
+ data.tar.gz: d4dd2ba2714e54c766592734481f7ba373692375f4c2011578f1b22da36fae3b8d58e721677e47ba214805d3798737c5ad6dec7711d586a46727029e555fb72e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (1.8.0)
4
+ gitlab_quality-test_tooling (1.8.1)
5
5
  activesupport (>= 6.1, < 7.2)
6
6
  amatch (~> 0.4.1)
7
7
  gitlab (~> 4.19)
data/README.md CHANGED
@@ -130,11 +130,13 @@ Usage: exe/update-screenshot-paths [options]
130
130
 
131
131
  ```shell
132
132
  Purpose: Create slow test issues from JSON RSpec report files
133
- Usage: exe/slow-test-issue [options]
133
+ Usage: exe/slow-test-issues [options]
134
134
  -i, --input-files INPUT_FILES JSON RSpec report files JSON
135
135
  -p, --project PROJECT Can be an integer or a group/project string
136
136
  -t, --token TOKEN A valid access token with `api` scope and Maintainer permission in PROJECT
137
- --dry-run Perform a dry-run (don't create note)
137
+ -r RELATED_ISSUES_FILE, The file path for the related issues
138
+ --related-issues-file
139
+ --dry-run Perform a dry-run (don't create issues)
138
140
  -v, --version Show the version
139
141
  -h, --help Show the usage
140
142
  ```
@@ -143,13 +145,13 @@ Usage: exe/slow-test-issue [options]
143
145
 
144
146
  ```shell
145
147
  Purpose: Purpose: Create flaky test issues for any passed test coming from rspec-retry JSON report files
146
- Usage: exe/flaky-test-issue [options]
148
+ Usage: exe/flaky-test-issues [options]
147
149
  -i, --input-files INPUT_FILES JSON rspec-retry report files
148
150
  -p, --project PROJECT Can be an integer or a group/project string
149
151
  -m MERGE_REQUEST_IID, An integer merge request IID
150
152
  --merge_request_iid
151
153
  -t, --token TOKEN A valid access token with `api` scope and Maintainer permission in PROJECT
152
- --dry-run Perform a dry-run (don't create note)
154
+ --dry-run Perform a dry-run (don't create issues)
153
155
  -v, --version Show the version
154
156
  -h, --help Show the usage
155
157
  ```
@@ -160,11 +162,11 @@ Usage: exe/flaky-test-issue [options]
160
162
  Purpose: Create slow test note on merge requests from JSON RSpec report files
161
163
  Usage: exe/slow-test-merge-request-report-note [options]
162
164
  -i, --input-files INPUT_FILES JSON RSpec report files JSON
163
- --project PROJECT Can be an integer or a group/project string
165
+ -p, --project PROJECT Can be an integer or a group/project string
164
166
  -m MERGE_REQUEST_IID, An integer merge request IID
165
167
  --merge_request_iid
166
168
  -t, --token TOKEN A valid access token with `api` scope and Maintainer permission in PROJECT
167
- --dry-run Perform a dry-run (don't create issues)
169
+ --dry-run Perform a dry-run (don't create note)
168
170
  -v, --version Show the version
169
171
  -h, --help Show the usage
170
172
  ```
@@ -167,9 +167,7 @@ module GitlabQuality
167
167
  def pipeline_issues_with_similar_stacktrace(test)
168
168
  search_labels = (base_issue_labels + Set.new(%w[test failure::new])).to_a
169
169
  not_labels = exclude_labels_for_search.to_a
170
- gitlab.find_issues(options: { labels: search_labels,
171
- not: { labels: not_labels },
172
- created_after: past_timestamp(2) }).select do |issue|
170
+ find_issues_created_after(past_timestamp(2), state: 'opened', labels: search_labels, not_labels: not_labels).select do |issue|
173
171
  job_url_from_issue = failed_issue_job_url(issue)
174
172
 
175
173
  next if pipeline != pipeline_env_from_job_url(job_url_from_issue)
@@ -196,6 +194,7 @@ module GitlabQuality
196
194
  def failure_issues(test)
197
195
  find_issues_for_test(
198
196
  test,
197
+ state: 'opened',
199
198
  labels: base_issue_labels + Set.new(%w[test]),
200
199
  not_labels: exclude_labels_for_search
201
200
  )
@@ -145,10 +145,19 @@ module GitlabQuality
145
145
  def find_issues_for_test(test, labels:, not_labels: Set.new, state: nil)
146
146
  search_options = { labels: labels.to_a, not: { labels: not_labels.to_a } }
147
147
  search_options[:state] = state if state
148
+ search_options[:search] = test.file.to_s.empty? ? test.name : partial_file_path(test.file)
149
+ search_options[:in] = 'title'
148
150
 
149
151
  gitlab.find_issues(options: search_options).find_all { |issue| issue_match_test?(issue, test) }
150
152
  end
151
153
 
154
+ def find_issues_created_after(timestamp, labels:, not_labels: Set.new, state: nil)
155
+ search_options = { labels: labels.to_a, not: { labels: not_labels.to_a }, created_after: timestamp }
156
+ search_options[:state] = state if state
157
+
158
+ gitlab.find_issues(options: search_options)
159
+ end
160
+
152
161
  def issue_match_test?(issue, test)
153
162
  issue_title = issue.title.strip
154
163
  test_file_path_found = !test.file.to_s.empty? && issue_title.include?(partial_file_path(test.file))
@@ -65,10 +65,18 @@ module GitlabQuality
65
65
  "1. #{Time.new.utc.strftime('%F')}: #{test.ci_job_url} (#{ENV.fetch('CI_PIPELINE_URL', 'pipeline url is missing')})"
66
66
  end
67
67
 
68
+ def slow_test_issues(test)
69
+ find_issues_for_test(
70
+ test,
71
+ state: 'opened',
72
+ labels: SEARCH_LABELS
73
+ )
74
+ end
75
+
68
76
  def create_slow_issue(test)
69
77
  puts " => Finding existing issues for slow test '#{test.name}' (run time: #{test.run_time} seconds)..."
70
78
 
71
- issues = find_issues_for_test(test, labels: SEARCH_LABELS, state: 'opened')
79
+ issues = slow_test_issues(test)
72
80
 
73
81
  if issues.blank?
74
82
  issues << create_issue(test)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "1.8.0"
5
+ VERSION = "1.8.1"
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: 1.8.0
4
+ version: 1.8.1
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-11-30 00:00:00.000000000 Z
11
+ date: 2023-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control