gitlab_quality-test_tooling 3.0.0 → 3.1.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: f037a73b3fd4a445324a37084915ea2d020475cca6f4e3b1d23045f290351082
4
- data.tar.gz: e32bc045856df09004e725b9b84317c74ffb66b59ed640b078e292f46a3ff565
3
+ metadata.gz: be0541b0d2e39102c7665bb733cdd068467959cf727bee7cafc385d2117b2689
4
+ data.tar.gz: 0dcc0e738cc51add35954ad281e7c0a86aa8662956e6133644f72bafd28b03a5
5
5
  SHA512:
6
- metadata.gz: 400c1e51bf57a3f10cdb36c083444153326da8710edd828839881867aed4d9282da4b21fa16357f49bb498ac48199dda888e422e1ddf4f5453769cb5bdc92211
7
- data.tar.gz: cc071d0ca3c54a0d3408f6fc91165348c403ab5109c473d7bc518701a17f90d992f02139614dfb99fd53cac7e0ffef688241c7c232cf373344269ffe3e8b4436
6
+ metadata.gz: a9f3927bc5646c115610015be3b780408518de92b8ebd741fc9270605fbf93e4a976b7eeb460a0d988b11cbadbfe154ccdb937da24f05637ae5574cb2cdd0f18
7
+ data.tar.gz: 9c641bc6e4f22c57fd16b5481a47d09ac45eac346b0b52da7f70ba3f4f4954d8e25e56fa54e9a8df5f939da95fb54c09d8dafc0d9f9e6e3733e7e1bc9e85da37
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (3.0.0)
5
- activesupport (>= 7.0, < 7.3)
4
+ gitlab_quality-test_tooling (3.1.0)
5
+ activesupport (>= 7.0)
6
6
  amatch (~> 0.4.1)
7
7
  fog-google (~> 1.24, >= 1.24.1)
8
8
  gitlab (>= 4.19, < 7.0)
@@ -52,6 +52,7 @@ module GitlabQuality
52
52
  :skip_record_proc,
53
53
  :test_retried_proc,
54
54
  :custom_metrics_proc,
55
+ :spec_file_path_prefix,
55
56
  :logger
56
57
 
57
58
  # rubocop:disable Style/TrivialAccessors -- allows documenting that setting config enables the export as well as document input class type
@@ -108,6 +109,13 @@ module GitlabQuality
108
109
  @extra_rspec_metadata_keys ||= []
109
110
  end
110
111
 
112
+ # Extra path prefix for constructing full file path within mono-repository setups
113
+ #
114
+ # @return [String]
115
+ def spec_file_path_prefix
116
+ @spec_file_path_prefix ||= ""
117
+ end
118
+
111
119
  # A lambda that determines whether to skip recording a test result
112
120
  #
113
121
  # This is useful when you would want to skip initial failure when retrying specs is set up in a separate process
@@ -46,12 +46,15 @@ module GitlabQuality
46
46
  status: example.execution_result.status,
47
47
  run_time: (example.execution_result.run_time * 1000).round,
48
48
  location: example_location,
49
- exception_class: exception_class,
49
+ # TODO: remove exception_class once migration to exception_classes is fully complete on clickhouse side
50
+ exception_class: example.execution_result.exception&.class&.to_s,
51
+ exception_classes: exception_classes.map { |e| e.class.to_s }.uniq,
50
52
  failure_exception: failure_exception,
51
53
  quarantined: quarantined?,
52
54
  feature_category: example.metadata[:feature_category] || "",
53
55
  test_retried: config.test_retried_proc.call(example),
54
- run_type: run_type
56
+ run_type: run_type,
57
+ spec_file_path_prefix: config.spec_file_path_prefix
55
58
  }
56
59
  end
57
60
 
@@ -127,22 +130,25 @@ module GitlabQuality
127
130
  @file_path ||= example_location.gsub(/:\d+$/, "")
128
131
  end
129
132
 
130
- # Failure exception class
133
+ # Failure exception classes
131
134
  #
132
- # @return [String]
133
- def exception_class
134
- example.execution_result.exception&.class&.to_s
135
+ # @return [Array<Exception>]
136
+ def exception_classes
137
+ exception = example.execution_result.exception
138
+ return [] unless exception
139
+ return [exception] unless exception.respond_to?(:all_exceptions)
140
+
141
+ exception.all_exceptions.flatten
135
142
  end
136
143
 
137
144
  # Truncated exception stacktrace
138
145
  #
139
146
  # @return [String]
140
147
  def failure_exception
141
- example.execution_result.exception.then do |exception|
142
- next unless exception
148
+ exception = example.execution_result.exception
149
+ return unless exception
143
150
 
144
- exception.to_s.tr("\n", " ").slice(0, 1000)
145
- end
151
+ exception.to_s.tr("\n", " ").slice(0, 1000)
146
152
  end
147
153
 
148
154
  # Test run type | suite name
@@ -65,6 +65,7 @@ module GitlabQuality
65
65
  test_retried Bool,
66
66
  feature_category LowCardinality(String) DEFAULT 'unknown',
67
67
  run_type LowCardinality(String) DEFAULT 'unknown',
68
+ spec_file_path_prefix LowCardinality(String) DEFAULT '',
68
69
  ci_project_id UInt32,
69
70
  ci_job_name LowCardinality(String),
70
71
  ci_job_id UInt64,
@@ -75,6 +76,7 @@ module GitlabQuality
75
76
  ci_target_branch LowCardinality(String),
76
77
  ci_server_url LowCardinality(String) DEFAULT 'https://gitlab.com',
77
78
  exception_class String DEFAULT '',
79
+ exception_classes Array(String) DEFAULT [],
78
80
  failure_exception String DEFAULT ''
79
81
  )
80
82
  ENGINE = MergeTree()
@@ -8,6 +8,7 @@ module GitlabQuality
8
8
  "Net::ReadTimeout",
9
9
  "403 Forbidden - Your account has been blocked",
10
10
  "API failed (502) with `GitLab is not responding",
11
+ "Error Code: 502",
11
12
  "unexpected token at 'GitLab is not responding'",
12
13
  "GitLab: Internal API error (502).",
13
14
  "could not be found (502)",
@@ -127,14 +128,26 @@ module GitlabQuality
127
128
  end
128
129
 
129
130
  def full_stacktrace
131
+ page_error_failure = ""
132
+ first_non_ignored_failure = ""
133
+
130
134
  failures.each do |failure|
131
135
  message = failure['message'] || ""
132
136
  message_lines = failure['message_lines'] || []
133
137
 
134
138
  next if IGNORED_FAILURES.any? { |e| message.include?(e) }
135
139
 
136
- return message_lines.empty? ? message : message_lines.join("\n")
140
+ formatted_failure = message_lines.empty? ? message : message_lines.join("\n")
141
+
142
+ if message.include?("PageErrorChecker")
143
+ page_error_failure = formatted_failure
144
+ elsif first_non_ignored_failure.empty?
145
+ first_non_ignored_failure = formatted_failure
146
+ end
137
147
  end
148
+
149
+ # Return PageErrorChecker failure if found, otherwise first non-ignored failure
150
+ page_error_failure.empty? ? first_non_ignored_failure : page_error_failure
138
151
  end
139
152
 
140
153
  def calls_shared_examples?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "3.0.0"
5
+ VERSION = "3.1.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: 3.0.0
4
+ version: 3.1.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-11-17 00:00:00.000000000 Z
11
+ date: 2025-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -227,9 +227,6 @@ dependencies:
227
227
  - - ">="
228
228
  - !ruby/object:Gem::Version
229
229
  version: '7.0'
230
- - - "<"
231
- - !ruby/object:Gem::Version
232
- version: '7.3'
233
230
  type: :runtime
234
231
  prerelease: false
235
232
  version_requirements: !ruby/object:Gem::Requirement
@@ -237,9 +234,6 @@ dependencies:
237
234
  - - ">="
238
235
  - !ruby/object:Gem::Version
239
236
  version: '7.0'
240
- - - "<"
241
- - !ruby/object:Gem::Version
242
- version: '7.3'
243
237
  - !ruby/object:Gem::Dependency
244
238
  name: amatch
245
239
  requirement: !ruby/object:Gem::Requirement