gitlab_quality-test_tooling 0.4.1 → 0.4.3

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: c7119bececf62cc7d2d1aa0a025c4ee193535d74cfe62777e2e4b2ff88590687
4
- data.tar.gz: 3e5a13270e9718b683d9554583a4b6b3c1d5f2a3bd5109477b51cdd931610600
3
+ metadata.gz: 710c5fd717aaeb8311c535e229573763b36fdf8437bc4d561aa5307441740747
4
+ data.tar.gz: f790b54c1f16a507d416a216d9457c55e86ed91c6776c60dbc3c5c0963ef22e1
5
5
  SHA512:
6
- metadata.gz: c4cbc83f6bba83bd34ed42e619382778b5255dcc94df168d1cf0436c3b7f2d16c191ed9a6997db3d31e2cc030551a6359d30dc0ec380a8badc8e99d7373e070d
7
- data.tar.gz: a87000a5dec45c065e46f836e9f1a7002d43aedf5c4eb11f59f9e69f321bad17537cc035269a7ce3adabef06e189b53cf69d46441bb7c5c245abd3b595a8df8b
6
+ metadata.gz: d74b227420252c2fd0ec41e0494c18f47f2be12e093eea47c44c97ccbd6e613c1990f257d928c7c9dfd3684b6685e0212667d6099d1ba4e3c03eaa77ed129db5
7
+ data.tar.gz: 49e42227f975b6a91ddae3052c2b4ac62fa47f462427a4a051462e57e4ff8ffed62e709470426864d324beb4c54b86e3b51aecc425290ef02084218551de76f6
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.3)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
@@ -269,7 +269,7 @@ module GitlabQuality
269
269
  <<~MARKDOWN.chomp
270
270
  ## Link to Grafana dashboard for run-type of #{Runtime::Env.qa_run_type}
271
271
 
272
- * https://dashboards.quality.gitlab.net/d/kuNYMgDnz/test-run-metrics?orgId=1&refresh=1m&var-run_type=#{Runtime::Env.qa_run_type}
272
+ * https://dashboards.quality.gitlab.net/d/tR_SmBDVk/main-runs?orgId=1&refresh=1m&var-run_type=#{Runtime::Env.qa_run_type}
273
273
  MARKDOWN
274
274
  end
275
275
  end
@@ -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.3"
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.3
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-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control