gitlab_quality-test_tooling 2.7.0 → 2.9.0

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: bc2b98142fc0891fe937da031f64a665ef016c153263b01b7c9820b284967800
4
- data.tar.gz: 588d0cec55fb89405d61d6e41528343929d948fe6fb03717edf2e895fe727e5c
3
+ metadata.gz: 737a2e86ac9d3545cf1c5f5b9344fead1e03d12dd4a6fe0f9b7ed44b00f604e6
4
+ data.tar.gz: 99cac62fe8e0672f28930be527ad4ef73743ca8d63c5e59734f610e2e3624ca9
5
5
  SHA512:
6
- metadata.gz: 2402289c4b5282ad62289b7560b0faadc8cabc675d7e0262b38e6582cee5e2e6a2711ab053dc677d2e32d917c8a29608e8b90b485d977d4fe244c6a7e4c47505
7
- data.tar.gz: 4bebf905075eb9b8ca2fb707c004d78746d8d8e518a6e10ee7d1085a2e3450b8a33d672a9ef382103deaf996591bd1f7c6b5d86f2249276a7a576a61074acbd7
6
+ metadata.gz: dac0023706ab1428abc046d6189e7c6df3ad684e4a7f70fcbed84633505c20a515e399e4050c3427584abceb1008e61908c9aacc5286f9dd74431d04e1423149
7
+ data.tar.gz: 876fa1ec99dcba949757b9f9073a4b118c4f98d877c1c2edfd3bcb55850cbf9de48683684de427536d13b21639d7f66aff98a552abe6d80ec1bd582db6385058
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (2.7.0)
5
- activesupport (>= 7.0, < 7.2)
4
+ gitlab_quality-test_tooling (2.9.0)
5
+ activesupport (>= 7.0, < 7.3)
6
6
  amatch (~> 0.4.1)
7
7
  fog-google (~> 1.24, >= 1.24.1)
8
8
  gitlab (>= 4.19, < 6.0)
@@ -5,20 +5,14 @@ module GitlabQuality
5
5
  module Report
6
6
  module Concerns
7
7
  module GroupAndCategoryLabels
8
- def labels_inference
9
- @labels_inference ||= GitlabQuality::TestTooling::LabelsInference.new
10
- end
11
-
12
- def new_issue_labels(test)
13
- debug_line = ' => [DEBUG] '
14
- debug_line += "product_group: #{test&.product_group}; " if test.respond_to?(:product_group)
15
- debug_line += "feature_category: #{test&.feature_category}" if test.respond_to?(:feature_category)
16
- puts debug_line
8
+ def group_and_category_labels_for_test(test)
9
+ labels_inference = GitlabQuality::TestTooling::LabelsInference.new
10
+ new_labels = Set.new
17
11
 
18
- new_labels = self.class::NEW_ISSUE_LABELS
19
12
  new_labels += labels_inference.infer_labels_from_product_group(test.product_group) if test.respond_to?(:product_group)
20
13
  new_labels += labels_inference.infer_labels_from_feature_category(test.feature_category) if test.respond_to?(:feature_category)
21
- up_to_date_labels(test: test, new_labels: new_labels)
14
+
15
+ new_labels
22
16
  end
23
17
  end
24
18
  end
@@ -15,6 +15,10 @@ module GitlabQuality
15
15
  "#{title[...MAX_TITLE_LENGTH - 3]}..."
16
16
  end
17
17
 
18
+ def label_names_to_label_quick_action(label_names)
19
+ %(/label #{label_names.map { |label| %(~"#{label}") }.join(' ')})
20
+ end
21
+
18
22
  def new_issue_title(test)
19
23
  "[Test] #{partial_file_path(test.file)} | #{search_safe(test.name)}".strip
20
24
  end
@@ -57,7 +57,7 @@ module GitlabQuality
57
57
  current_reports_note = find_failure_discussion_note(issue: issue, test: test, reports_discussion: reports_discussion)
58
58
 
59
59
  new_reports_list = new_reports_list(current_reports_note: current_reports_note, test: test)
60
- note_body = new_note_body(
60
+ note_body = append_quick_actions_to_note(
61
61
  new_reports_list: new_reports_list,
62
62
  related_issues: related_issues,
63
63
  options: {
@@ -105,6 +105,14 @@ module GitlabQuality
105
105
  IDENTITY_LABELS
106
106
  end
107
107
 
108
+ def new_issue_labels(test)
109
+ up_to_date_labels(test: test, new_labels: NEW_ISSUE_LABELS + group_and_category_labels_for_test(test))
110
+ end
111
+
112
+ def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
113
+ (base_issue_labels + super).to_a
114
+ end
115
+
108
116
  def report_section_header
109
117
  REPORT_SECTION_HEADER
110
118
  end
@@ -139,10 +147,6 @@ module GitlabQuality
139
147
  quick_actions.join("\n")
140
148
  end
141
149
 
142
- def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
143
- (base_issue_labels + super).to_a
144
- end
145
-
146
150
  def find_failure_discussion_note(issue:, test:, reports_discussion:)
147
151
  return unless reports_discussion
148
152
 
@@ -44,6 +44,14 @@ module GitlabQuality
44
44
  IDENTITY_LABELS
45
45
  end
46
46
 
47
+ def new_issue_labels(test)
48
+ up_to_date_labels(test: test, new_labels: NEW_ISSUE_LABELS)
49
+ end
50
+
51
+ def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
52
+ (base_issue_labels + super).to_a
53
+ end
54
+
47
55
  def report_section_header
48
56
  REPORT_SECTION_HEADER
49
57
  end
@@ -52,22 +60,22 @@ module GitlabQuality
52
60
  REPORTS_DOCUMENTATION
53
61
  end
54
62
 
55
- def health_problem_status_label_quick_action(reports_list, **)
63
+ def health_problem_status_label_quick_action(reports_list, options: {})
56
64
  case reports_list.reports_count
57
65
  when 399..Float::INFINITY
58
- '/label ~"flakiness::1"'
66
+ label_names = Set.new(['flakiness::1'])
67
+ label_names += group_and_category_labels_for_test(options[:test]) if options.key?(:test)
68
+ label_names_to_label_quick_action(label_names)
59
69
  when 37..398
60
- '/label ~"flakiness::2"'
70
+ label_names = Set.new(['flakiness::2'])
71
+ label_names += group_and_category_labels_for_test(options[:test]) if options.key?(:test)
72
+ label_names_to_label_quick_action(label_names)
61
73
  when 13..36
62
74
  '/label ~"flakiness::3"'
63
75
  else
64
76
  '/label ~"flakiness::4"'
65
77
  end
66
78
  end
67
-
68
- def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
69
- (base_issue_labels + super).to_a
70
- end
71
79
  end
72
80
  end
73
81
  end
@@ -45,6 +45,10 @@ module GitlabQuality
45
45
  []
46
46
  end
47
47
 
48
+ def new_issue_labels(_test)
49
+ []
50
+ end
51
+
48
52
  def search_labels
49
53
  BASE_SEARCH_LABELS
50
54
  end
@@ -57,10 +61,6 @@ module GitlabQuality
57
61
  ''
58
62
  end
59
63
 
60
- def health_problem_status_label_quick_action(*)
61
- ''
62
- end
63
-
64
64
  def item_extra_content(_test)
65
65
  found_label
66
66
  end
@@ -115,7 +115,13 @@ module GitlabQuality
115
115
  current_reports_note = existing_reports_note(issue_iid: issue.iid)
116
116
 
117
117
  new_reports_list = new_reports_list(current_reports_note: current_reports_note, test: test)
118
- note_body = new_note_body(new_reports_list: new_reports_list, related_issues: related_issues)
118
+ note_body = append_quick_actions_to_note(
119
+ new_reports_list: new_reports_list,
120
+ related_issues: related_issues,
121
+ options: {
122
+ test: test
123
+ }
124
+ )
119
125
 
120
126
  if current_reports_note
121
127
  gitlab.edit_issue_note(
@@ -138,7 +144,7 @@ module GitlabQuality
138
144
  )
139
145
  end
140
146
 
141
- def new_note_body(new_reports_list:, related_issues:, options: {})
147
+ def append_quick_actions_to_note(new_reports_list:, related_issues:, options: {})
142
148
  report = new_reports_list
143
149
 
144
150
  quick_actions = [
@@ -164,10 +170,15 @@ module GitlabQuality
164
170
  end
165
171
  end
166
172
 
173
+ # Defined in subclasses
174
+ def health_problem_status_label_quick_action(*)
175
+ ''
176
+ end
177
+
167
178
  def identity_labels_quick_action
168
179
  return if identity_labels.empty?
169
180
 
170
- %(/label #{identity_labels.map { |label| %(~"#{label}") }.join(' ')})
181
+ label_names_to_label_quick_action(identity_labels)
171
182
  end
172
183
 
173
184
  def relate_issues_quick_actions(issues)
@@ -39,6 +39,10 @@ module GitlabQuality
39
39
  search_and_create_issue
40
40
  end
41
41
 
42
+ def new_issue_labels(test)
43
+ up_to_date_labels(test: test, new_labels: NEW_ISSUE_LABELS + group_and_category_labels_for_test(test))
44
+ end
45
+
42
46
  def search_and_create_issue
43
47
  filtered_report = KnapsackReports::SpecRunTimeReport.new(
44
48
  token: token,
@@ -80,6 +80,14 @@ module GitlabQuality
80
80
  end
81
81
  end
82
82
 
83
+ def new_issue_labels(test)
84
+ up_to_date_labels(test: test, new_labels: NEW_ISSUE_LABELS + group_and_category_labels_for_test(test))
85
+ end
86
+
87
+ def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
88
+ (Set.new(base_issue_labels) + (super << pipeline_name_label)).to_a
89
+ end
90
+
83
91
  def test_metric_collections
84
92
  @test_metric_collections ||= Dir.glob(metrics_files).map do |path|
85
93
  TestMetrics::JsonTestMetricCollection.new(path)
@@ -448,10 +456,6 @@ module GitlabQuality
448
456
  section
449
457
  end
450
458
 
451
- def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
452
- (Set.new(base_issue_labels) + (super << pipeline_name_label)).to_a
453
- end
454
-
455
459
  def new_issue_assignee_id(test)
456
460
  return unless test.product_group?
457
461
 
@@ -144,6 +144,9 @@ module GitlabQuality
144
144
  gitlab.edit_issue(iid: issue.iid, options: { labels: labels.to_a })
145
145
  end
146
146
 
147
+ # Infer labels from the test, and optionally from the issue and new_labels in arguments
148
+ #
149
+ # Called when we're updating a test health issue with a new test report.
147
150
  def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
148
151
  labels = issue_labels(issue)
149
152
  labels |= new_labels.to_set
@@ -34,6 +34,10 @@ module GitlabQuality
34
34
  IDENTITY_LABELS
35
35
  end
36
36
 
37
+ def new_issue_labels(test)
38
+ up_to_date_labels(test: test, new_labels: NEW_ISSUE_LABELS)
39
+ end
40
+
37
41
  def report_section_header
38
42
  REPORT_SECTION_HEADER
39
43
  end
@@ -42,12 +46,16 @@ module GitlabQuality
42
46
  REPORTS_DOCUMENTATION
43
47
  end
44
48
 
45
- def health_problem_status_label_quick_action(reports_list, **)
49
+ def health_problem_status_label_quick_action(reports_list, options: {})
46
50
  case reports_list.reports_count
47
51
  when 6099..Float::INFINITY
48
- '/label ~"slowness::1"'
52
+ label_names = Set.new(['slowness::1'])
53
+ label_names += group_and_category_labels_for_test(options[:test]) if options.key?(:test)
54
+ label_names_to_label_quick_action(label_names)
49
55
  when 2177..6098
50
- '/label ~"slowness::2"'
56
+ label_names = Set.new(['slowness::2'])
57
+ label_names += group_and_category_labels_for_test(options[:test]) if options.key?(:test)
58
+ label_names_to_label_quick_action(label_names)
51
59
  when 521..2176
52
60
  '/label ~"slowness::3"'
53
61
  else
@@ -13,7 +13,8 @@ module GitlabQuality
13
13
  "could not be found (502)",
14
14
  "Error reference number: 502",
15
15
  "(502): `GitLab is not responding`",
16
- "<head><title>502 Bad Gateway</title></head>"
16
+ "<head><title>502 Bad Gateway</title></head>",
17
+ "14:connections to all backends failing"
17
18
  ].freeze
18
19
 
19
20
  SHARED_EXAMPLES_CALLERS = %w[include_examples it_behaves_like].freeze
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "2.7.0"
5
+ VERSION = "2.9.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: 2.7.0
4
+ version: 2.9.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: 2025-02-13 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -215,7 +215,7 @@ dependencies:
215
215
  version: '7.0'
216
216
  - - "<"
217
217
  - !ruby/object:Gem::Version
218
- version: '7.2'
218
+ version: '7.3'
219
219
  type: :runtime
220
220
  prerelease: false
221
221
  version_requirements: !ruby/object:Gem::Requirement
@@ -225,7 +225,7 @@ dependencies:
225
225
  version: '7.0'
226
226
  - - "<"
227
227
  - !ruby/object:Gem::Version
228
- version: '7.2'
228
+ version: '7.3'
229
229
  - !ruby/object:Gem::Dependency
230
230
  name: amatch
231
231
  requirement: !ruby/object:Gem::Requirement
@@ -554,14 +554,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
554
554
  requirements:
555
555
  - - ">="
556
556
  - !ruby/object:Gem::Version
557
- version: 3.1.0
557
+ version: 3.2.0
558
558
  required_rubygems_version: !ruby/object:Gem::Requirement
559
559
  requirements:
560
560
  - - ">="
561
561
  - !ruby/object:Gem::Version
562
562
  version: '0'
563
563
  requirements: []
564
- rubygems_version: 3.3.27
564
+ rubygems_version: 3.5.22
565
565
  signing_key:
566
566
  specification_version: 4
567
567
  summary: A collection of test-related tools.