gitlab_quality-test_tooling 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7119bececf62cc7d2d1aa0a025c4ee193535d74cfe62777e2e4b2ff88590687
4
- data.tar.gz: 3e5a13270e9718b683d9554583a4b6b3c1d5f2a3bd5109477b51cdd931610600
3
+ metadata.gz: '09db516b126bd859b0d15c2a02eafe9be450b362253248d017f30f8e22c83b22'
4
+ data.tar.gz: 42a2999e91fb42a288985212156daf500e99e38084b10207385773b0ed130a8f
5
5
  SHA512:
6
- metadata.gz: c4cbc83f6bba83bd34ed42e619382778b5255dcc94df168d1cf0436c3b7f2d16c191ed9a6997db3d31e2cc030551a6359d30dc0ec380a8badc8e99d7373e070d
7
- data.tar.gz: a87000a5dec45c065e46f836e9f1a7002d43aedf5c4eb11f59f9e69f321bad17537cc035269a7ce3adabef06e189b53cf69d46441bb7c5c245abd3b595a8df8b
6
+ metadata.gz: edb9ac2763c96f21fdf584a2002ba6522eb5c6a61bbc7ce604453c4d61d87fc7103489f2f386afa5e5d8ba660a4377796ca5cf57765f4848425fb194ce006737
7
+ data.tar.gz: 33fb7a6951bbdfec91b2be742a82dd91528ca2f27fbb346ae722bc93ad8505e5344e65d77f276445e89bb7c431e509b6841b9a7cdc26629fda7786f2704571ca
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (0.4.1)
4
+ gitlab_quality-test_tooling (0.4.2)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
@@ -60,10 +60,10 @@ module GitlabQuality
60
60
  puts " => Searching issues for test '#{test.name}'..."
61
61
 
62
62
  begin
63
- issue = test.quarantine? ? find_and_link_issue(test) : find_and_link_issue(test) || create_issue(test)
64
- return unless issue
63
+ issue, issue_already_commented = find_and_link_issue(test)
64
+ return create_issue(test) unless issue || test.quarantine?
65
65
 
66
- update_labels(issue, test)
66
+ update_labels(issue, test) unless issue_already_commented
67
67
  rescue MultipleIssuesFound => e
68
68
  warn(e.message)
69
69
  end
@@ -71,19 +71,22 @@ module GitlabQuality
71
71
 
72
72
  def find_and_link_issue(test)
73
73
  issue, diff_ratio = find_failure_issue(test)
74
- issue_already_commented = issue ? @commented_issue_list.include?(issue.web_url) : nil
74
+ return [false, true] unless issue
75
75
 
76
- if issue && !issue_already_commented
76
+ issue_already_commented = issue_already_commented?(issue)
77
+ if issue_already_commented
78
+ puts " => Failure already commented on issue."
79
+ else
77
80
  puts " => Found issue #{issue.web_url} for test '#{test.name}' with a diff ratio of #{(diff_ratio * 100).round(2)}%."
78
81
  post_or_update_failed_job_note(issue, test)
79
82
  @commented_issue_list.add(issue.web_url)
80
- else
81
- puts " => Failure already commented on issue." if issue_already_commented
82
-
83
- return false
84
83
  end
85
84
 
86
- issue
85
+ [issue, issue_already_commented]
86
+ end
87
+
88
+ def issue_already_commented?(issue)
89
+ @commented_issue_list.include?(issue.web_url)
87
90
  end
88
91
 
89
92
  def create_issue(test)
@@ -94,8 +97,11 @@ module GitlabQuality
94
97
  puts " => Will not create new issue for this failing spec"
95
98
  similar_issues.each do |similar_issue|
96
99
  puts "Please check issue: #{similar_issue.web_url}"
97
- gitlab.create_issue_note(iid: similar_issue.iid,
98
- note: "This failed job is most likely related: #{test.ci_job_url}")
100
+
101
+ unless existing_failure_note(similar_issue, test.ci_job_url)
102
+ gitlab.create_issue_note(iid: similar_issue.iid,
103
+ note: "This failed job is most likely related: #{test.ci_job_url}")
104
+ end
99
105
  end
100
106
  return
101
107
  end
@@ -309,9 +315,9 @@ module GitlabQuality
309
315
  "Failure in #{super}"
310
316
  end
311
317
 
312
- def existing_failure_note(issue)
318
+ def existing_failure_note(issue, content = "Failed most recently in")
313
319
  gitlab.find_issue_notes(iid: issue.iid)&.find do |note|
314
- note.body.include?('Failed most recently in')
320
+ note.body.include?(content)
315
321
  end
316
322
  end
317
323
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "0.4.1"
5
+ VERSION = "0.4.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.4.1
4
+ version: 0.4.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-17 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control