gitlab_quality-test_tooling 1.34.0 → 1.36.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: 6d3f45e3af6f11c3ebca5f44f3d717960c1ac20cffdc13db75a16d68c9eecfbd
4
- data.tar.gz: 0edf629fc7f432a779141be67a231887224a78793defedad416df50b327ecbcb
3
+ metadata.gz: 25fe4fd0cb49b8e51816f2da8c88e0722e81c4bd1b71e6ba3f980a8a1ca0e255
4
+ data.tar.gz: 679100eddc3bcce725465a9e4c71808fde8917c9014d149639081c22daf95e03
5
5
  SHA512:
6
- metadata.gz: 7570cde0cd99ea0fe3148f9a8c1f9a7035c165fb0f5506623a79d3f2c3227581d6de878fd56c9a5d5f4c4bae22191d688f49355c74e4b4926b6362ef5d3f8d06
7
- data.tar.gz: 0112df035902806c60a82433118669b43bcd9feff89fd8dc7061ee6ffcda9c53ead791c7df4c188567b2b16ee3be8880e269088f4bee944b944aa2dafb60bfef
6
+ metadata.gz: db8f81ef6632edf827cce50997a2318f5d82c17a1714b3bf4cf6e0407aca5ad47bc34de92a49b3d45c3ad764a585085ff93baa1ce3da5da286dc5015ad61e113
7
+ data.tar.gz: 157ac822424ad6cf581ac9cd1993071474e5238d61b44f093080358f1829f95505488d9382819173c632e27f3cc9fff5bd8c3aee3efae51b84bc87ef0373b70d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (1.34.0)
4
+ gitlab_quality-test_tooling (1.36.0)
5
5
  activesupport (>= 7.0, < 7.2)
6
6
  amatch (~> 0.4.1)
7
7
  gitlab (~> 4.19)
@@ -44,11 +44,11 @@ module GitlabQuality
44
44
  pipeline = Runtime::Env.pipeline_from_project_name
45
45
  channel = case pipeline
46
46
  when "canary"
47
- "qa-production"
48
- when "staging-canary"
49
- "qa-staging"
47
+ "e2e-run-production"
48
+ when "staging", "staging-canary"
49
+ "e2e-run-staging"
50
50
  else
51
- "qa-#{pipeline}"
51
+ "e2e-run-#{pipeline}"
52
52
  end
53
53
 
54
54
  slack_options = {
@@ -20,6 +20,18 @@ module GitlabQuality
20
20
  FOUND_IN_MR_LABEL = '~"found:in MR"'
21
21
  FOUND_IN_MASTER_LABEL = '~"found:master"'
22
22
 
23
+ def initialize(input_files: [], **kwargs)
24
+ super(input_files: input_files, **kwargs)
25
+ end
26
+
27
+ def most_recent_report_date_for_issue(issue_iid:)
28
+ if report_in_discussion?
29
+ most_recent_report_from_discussion(issue_iid: issue_iid)
30
+ else
31
+ most_recent_report_from_note(issue_iid: issue_iid)
32
+ end
33
+ end
34
+
23
35
  private
24
36
 
25
37
  def problem_type
@@ -62,6 +74,28 @@ module GitlabQuality
62
74
  found_label
63
75
  end
64
76
 
77
+ def most_recent_report_from_discussion(issue_iid:)
78
+ reports_discussion = existing_reports_discussion(issue_iid: issue_iid)
79
+ return unless reports_discussion
80
+
81
+ # We're skipping the first note of the discussion as this is the "non-collapsible note", aka
82
+ # the "header note", which doesn't contain any stack trace.
83
+ reports_discussion.notes[1..].filter_map do |reports_note|
84
+ most_recent_report_from_reports_note(reports_note)&.report_date
85
+ end.max
86
+ end
87
+
88
+ def most_recent_report_from_note(issue_iid:)
89
+ reports_note = existing_reports_note(issue_iid: issue_iid)
90
+ return unless reports_note
91
+
92
+ most_recent_report_from_reports_note(reports_note)&.report_date
93
+ end
94
+
95
+ def most_recent_report_from_reports_note(reports_note)
96
+ @most_recent_report_from_reports_note ||= report_lines(reports_note&.body.to_s).first
97
+ end
98
+
65
99
  def run!
66
100
  puts "Reporting tests in `#{files.join(',')}` as issues in project `#{project}` via the API at `#{Runtime::Env.gitlab_api_base}`."
67
101
 
@@ -102,11 +136,11 @@ module GitlabQuality
102
136
  def add_report_to_issue(issue:, test:, related_issues:) # rubocop:disable Metrics/AbcSize -- FIXME
103
137
  current_reports_note =
104
138
  if report_in_discussion?
105
- reports_discussion = find_or_create_reports_discussion(issue: issue)
139
+ reports_discussion = find_or_create_reports_discussion(issue_iid: issue.iid)
106
140
 
107
141
  find_failure_discussion_note(issue: issue, test: test, reports_discussion: reports_discussion)
108
142
  else
109
- existing_reports_note(issue: issue)
143
+ existing_reports_note(issue_iid: issue.iid)
110
144
  end
111
145
 
112
146
  new_reports_list = add_report_for_test(current_reports_content: current_reports_note&.body.to_s, test: test)
@@ -135,15 +169,15 @@ module GitlabQuality
135
169
  end
136
170
  end
137
171
 
138
- def find_or_create_reports_discussion(issue:)
139
- reports_discussion = existing_reports_discussion(issue: issue)
172
+ def find_or_create_reports_discussion(issue_iid:)
173
+ reports_discussion = existing_reports_discussion(issue_iid: issue_iid)
140
174
  return reports_discussion if reports_discussion
141
175
 
142
- gitlab.create_issue_discussion(iid: issue.iid, note: report_section_header)
176
+ gitlab.create_issue_discussion(iid: issue_iid, note: report_section_header)
143
177
  end
144
178
 
145
- def existing_reports_discussion(issue:)
146
- gitlab.find_issue_discussions(iid: issue.iid).find do |discussion|
179
+ def existing_reports_discussion(issue_iid:)
180
+ gitlab.find_issue_discussions(iid: issue_iid).find do |discussion|
147
181
  next if discussion.individual_note
148
182
  next unless discussion.notes.first
149
183
 
@@ -151,8 +185,8 @@ module GitlabQuality
151
185
  end
152
186
  end
153
187
 
154
- def existing_reports_note(issue:)
155
- gitlab.find_issue_notes(iid: issue.iid).find do |note|
188
+ def existing_reports_note(issue_iid:)
189
+ gitlab.find_issue_notes(iid: issue_iid).find do |note|
156
190
  note.body.start_with?(report_section_header)
157
191
  end
158
192
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "1.34.0"
5
+ VERSION = "1.36.0"
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.34.0
4
+ version: 1.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-19 00:00:00.000000000 Z
11
+ date: 2024-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control