gitlab_quality-test_tooling 1.2.0 → 1.3.0

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: e05a68132442d20820791a87147d65bbd074dbaea120298b58139a60fefa63f9
4
- data.tar.gz: f79996624aabd47398eef61a8eb216da3427c3c5e2e204bc951ac2710530527e
3
+ metadata.gz: 8faeb526c0c3996945e423ca2c2d944f57bda93b1941beac376e9d4478bf8230
4
+ data.tar.gz: '09a401ff0c2c60effc2a9c55466ed266dceb7eed8b3c83aa1970c31837ec36dd'
5
5
  SHA512:
6
- metadata.gz: 1665a299d92b96ae41bc8f180f2eaa2d13e2a99c28b42eb61cc4ad5f3bdcdab65d657d5ed5219fd4d3b0f947a186fb02137dd36848bded57be2d6e99b035da42
7
- data.tar.gz: 3a25b39e0d6e1dc1451e22686e3bdd9ed8db17df61abbe4e6054e15f32a74657630161097337c8f82d8e756e1746f63f98e988c827a9ace901356321bf1a24e1
6
+ metadata.gz: e7ba58f29fb1d459a82e5bc078791ecd08b5e06737530b09f52facd3813e1f7de699b7227748e58a788ef16099c3a9e6aef8a97607a5b0ccb0adc7bc96a59ab0
7
+ data.tar.gz: 88f89b94c695450d2f0716e4927e11865dd5e9c3d356f1f6c106ece8ff86ab5797db88459dd7285acf8ee0b7b37952c829bc681ee1b5678f42f35643cc51aeb9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (1.2.0)
4
+ gitlab_quality-test_tooling (1.3.0)
5
5
  activesupport (>= 6.1, < 7.2)
6
6
  gitlab (~> 4.19)
7
7
  http (~> 5.0)
@@ -124,7 +124,7 @@ module GitlabQuality
124
124
 
125
125
  def pipeline_issues_with_similar_stacktrace(test)
126
126
  search_labels = (base_issue_labels + Set.new(%w[test failure::new])).to_a
127
- gitlab.find_issues(options: { state: 'opened', labels: search_labels,
127
+ gitlab.find_issues(options: { labels: search_labels,
128
128
  created_after: past_timestamp(2) }).select do |issue|
129
129
  job_url_from_issue = failed_issue_job_url(issue)
130
130
 
@@ -172,7 +172,7 @@ module GitlabQuality
172
172
  end
173
173
 
174
174
  def failure_issues(test)
175
- find_issues(test, (base_issue_labels + Set.new(%w[test])).to_a)
175
+ find_issues(test, (base_issue_labels + Set.new(%w[test])).to_a) # Search for opened and closed issues
176
176
  end
177
177
 
178
178
  def full_stacktrace(test)
@@ -330,10 +330,16 @@ module GitlabQuality
330
330
  end
331
331
 
332
332
  def update_reports(issue, test)
333
- gitlab.edit_issue(iid: issue.iid, options: {
333
+ # We reopen closed issues to not lose any history
334
+ state_event = issue.state == 'closed' ? 'reopen' : nil
335
+
336
+ issue_attrs = {
334
337
  description: up_to_date_issue_description(issue.description, test),
335
338
  labels: up_to_date_labels(test: test, issue: issue)
336
- })
339
+ }
340
+ issue_attrs[:state_event] = state_event if state_event
341
+
342
+ gitlab.edit_issue(iid: issue.iid, options: issue_attrs)
337
343
  puts " => Added a report in '#{issue.title}': #{issue.web_url}!"
338
344
  end
339
345
 
@@ -125,8 +125,11 @@ module GitlabQuality
125
125
  labels
126
126
  end
127
127
 
128
- def find_issues(test, labels)
129
- gitlab.find_issues(options: { state: 'opened', labels: labels.to_a }).find_all do |issue|
128
+ def find_issues(test, labels, state: nil)
129
+ search_options = { labels: labels.to_a }
130
+ search_options[:state] = state if state
131
+
132
+ gitlab.find_issues(options: search_options).find_all do |issue|
130
133
  issue_title = issue.title.strip
131
134
  issue_title.include?(test.name) || issue_title.include?(partial_file_path(test.file))
132
135
  end
@@ -49,7 +49,7 @@ module GitlabQuality
49
49
  def create_slow_issue(test)
50
50
  puts " => Finding existing issues for slow test '#{test.name}' (run time: #{test.run_time} seconds)..."
51
51
 
52
- issues = find_issues(test, SEARCH_LABELS)
52
+ issues = find_issues(test, SEARCH_LABELS, state: 'opened')
53
53
 
54
54
  issues.each do |issue|
55
55
  puts " => Existing issue link #{issue['web_url']}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "1.2.0"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_quality-test_tooling
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality