gitlab_quality-test_tooling 3.3.0 → 3.4.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: 32b52c2177aaf57f1ccf6a2bb922fd47e267b251ce74921c356f9631252051da
4
- data.tar.gz: 8930c0fb427f3a946cd99902a230bcf90c48a051c9ffa1d19fb10a487107d231
3
+ metadata.gz: 870c9853d71d7274b721d9f7bf0b6e23466da21ca5dec47a66aae9d3ebc62ea0
4
+ data.tar.gz: 242a18c953ae4259bce53f875c110be58e79d1b2477b07f8871d78a64aa7c5c6
5
5
  SHA512:
6
- metadata.gz: f265a7b7c74d4ef36e06c53a945b96ab066a4304acd0e6c439cf10afee6d0483de9253ca9290b279db7ec3c1d2323146da3aea8cf92aa57d4d1914c9c1479b1f
7
- data.tar.gz: b983b542d66e9ac5b5775dd97b80ce6b464a618a5adf573f18613014dcfecc86555fc8b7d20e32b33b41b23ce9be255811cc276a50a1ee7945f0e4062deb15cf
6
+ metadata.gz: 4469d2f5013331527e49b45356563d7f8f4de34c2a49eb9ea4860cfc87fdb96979d4d3d05152403264f5564a70febdb91cc46e4e93373d2cd6b16924641a400e
7
+ data.tar.gz: 585059565492ed297f43f60bc13ec7c747e6a5cacb1330e9a8f828735b6dd1e151c72cba938b251c9cff8bca4926d191d0b8b336da2deb069827b841d666989d
data/Gemfile.lock CHANGED
@@ -1,13 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (3.3.0)
4
+ gitlab_quality-test_tooling (3.4.0)
5
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)
9
9
  http (~> 5.0)
10
- influxdb-client (~> 3.1)
11
10
  nokogiri (~> 1.10)
12
11
  parallel (>= 1, < 2)
13
12
  rainbow (>= 3, < 4)
@@ -200,7 +199,6 @@ GEM
200
199
  httpclient (2.8.3)
201
200
  i18n (1.14.6)
202
201
  concurrent-ruby (~> 1.0)
203
- influxdb-client (3.1.0)
204
202
  jaro_winkler (1.6.0)
205
203
  json (2.7.2)
206
204
  jwt (2.9.3)
@@ -103,6 +103,10 @@ module GitlabQuality
103
103
  "#{ci_project_name}-#{test_subset}"
104
104
  end
105
105
 
106
+ def quarantine_disabled?
107
+ enabled?(ENV.fetch('GLCI_DISABLE_QUARANTINE', nil), default: false)
108
+ end
109
+
106
110
  private
107
111
 
108
112
  def enabled?(value, default: true)
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rspec/core/formatters/base_formatter"
4
+
5
+ module GitlabQuality
6
+ module TestTooling
7
+ module TestQuarantine
8
+ class QuarantineFormatter < ::RSpec::Core::Formatters::BaseFormatter
9
+ include QuarantineHelper
10
+
11
+ ::RSpec::Core::Formatters.register(
12
+ self,
13
+ :example_group_started,
14
+ :example_started
15
+ )
16
+
17
+ # Starts example group
18
+ # @param [RSpec::Core::Notifications::GroupNotification] example_group_notification
19
+ # @return [void]
20
+ def example_group_started(example_group_notification)
21
+ group = example_group_notification.group
22
+
23
+ skip_or_run_quarantined_tests_or_contexts(group)
24
+ end
25
+
26
+ # Starts example
27
+ # @param [RSpec::Core::Notifications::ExampleNotification] example_notification
28
+ # @return [void]
29
+ def example_started(example_notification)
30
+ example = example_notification.example
31
+
32
+ # if skip propagated from example_group, do not reset skip metadata
33
+ skip_or_run_quarantined_tests_or_contexts(example) unless example.metadata[:skip]
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core'
4
+
5
+ module GitlabQuality
6
+ module TestTooling
7
+ module TestQuarantine
8
+ module QuarantineHelper
9
+ include ::RSpec::Core::Pending
10
+
11
+ extend self
12
+
13
+ # Skip tests in quarantine unless we explicitly focus on them or quarantine disabled
14
+ def skip_or_run_quarantined_tests_or_contexts(example)
15
+ return if Runtime::Env.quarantine_disabled?
16
+
17
+ if filters.key?(:quarantine)
18
+ included_filters = filters_other_than_quarantine
19
+
20
+ # If :quarantine is focused, skip the test/context unless its metadata
21
+ # includes quarantine and any other filters
22
+ # E.g., Suppose a test is tagged :smoke and :quarantine, and another is tagged
23
+ # :ldap and :quarantine. If we wanted to run just quarantined smoke tests
24
+ # using `--tag quarantine --tag smoke`, without this check we'd end up
25
+ # running that ldap test as well because of the :quarantine metadata.
26
+ # We could use an exclusion filter, but this way the test report will list
27
+ # the quarantined tests when they're not run so that we're aware of them
28
+ if should_skip_when_focused?(example.metadata, included_filters)
29
+ example.metadata[:skip] = "Only running tests tagged with :quarantine and any of #{included_filters.keys}"
30
+ end
31
+ elsif example.metadata.key?(:quarantine)
32
+ quarantine_tag = example.metadata[:quarantine]
33
+
34
+ example.metadata[:skip] = quarantine_message(quarantine_tag)
35
+ end
36
+ end
37
+
38
+ def filters_other_than_quarantine
39
+ filters.except(:quarantine)
40
+ end
41
+
42
+ def quarantine_message(quarantine_tag)
43
+ quarantine_message = %w[In quarantine]
44
+ quarantine_message << case quarantine_tag
45
+ when String
46
+ ": #{quarantine_tag}"
47
+ when Hash
48
+ quarantine_tag.key?(:issue) ? ": #{quarantine_tag[:issue]}" : ''
49
+ else
50
+ ''
51
+ end
52
+
53
+ quarantine_message.join(' ').strip
54
+ end
55
+
56
+ # Checks if a test or context should be skipped.
57
+ #
58
+ # Returns true if
59
+ # - the metadata does not includes the :quarantine tag
60
+ # or if
61
+ # - the metadata includes the :quarantine tag
62
+ # - and the filter includes other tags that aren't in the metadata
63
+ def should_skip_when_focused?(metadata, included_filters)
64
+ return true unless metadata.key?(:quarantine)
65
+ return false if included_filters.empty?
66
+
67
+ !metadata.keys.intersect?(included_filters.keys)
68
+ end
69
+
70
+ def filters
71
+ @filters ||= ::RSpec.configuration.inclusion_filter.rules
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "3.3.0"
5
+ VERSION = "3.4.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.3.0
4
+ version: 3.4.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-12-18 00:00:00.000000000 Z
11
+ date: 2026-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -302,20 +302,6 @@ dependencies:
302
302
  - - "~>"
303
303
  - !ruby/object:Gem::Version
304
304
  version: '5.0'
305
- - !ruby/object:Gem::Dependency
306
- name: influxdb-client
307
- requirement: !ruby/object:Gem::Requirement
308
- requirements:
309
- - - "~>"
310
- - !ruby/object:Gem::Version
311
- version: '3.1'
312
- type: :runtime
313
- prerelease: false
314
- version_requirements: !ruby/object:Gem::Requirement
315
- requirements:
316
- - - "~>"
317
- - !ruby/object:Gem::Version
318
- version: '3.1'
319
305
  - !ruby/object:Gem::Dependency
320
306
  name: nokogiri
321
307
  requirement: !ruby/object:Gem::Requirement
@@ -594,6 +580,8 @@ files:
594
580
  - lib/gitlab_quality/test_tooling/test_metrics_exporter/formatter.rb
595
581
  - lib/gitlab_quality/test_tooling/test_metrics_exporter/test_metrics.rb
596
582
  - lib/gitlab_quality/test_tooling/test_metrics_exporter/utils.rb
583
+ - lib/gitlab_quality/test_tooling/test_quarantine/quarantine_formatter.rb
584
+ - lib/gitlab_quality/test_tooling/test_quarantine/quarantine_helper.rb
597
585
  - lib/gitlab_quality/test_tooling/test_result/base_test_result.rb
598
586
  - lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb
599
587
  - lib/gitlab_quality/test_tooling/test_result/json_test_result.rb