datadog-ci 1.41.0 → 1.42.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: de15dc03a13226b87763dc2942794ffd12ec4f5b9b19f0430d93b03216f20da6
4
- data.tar.gz: 2eaab3c59263e48c75dcdd237aba4db7bdac0e8578069b4e628866cdcd155a34
3
+ metadata.gz: 5a8c5bcf57d8d00cf4b72205835c2bcfa651cf5dbb8146bc080d0beca7a3cc72
4
+ data.tar.gz: '029e12e12d747a2854a8b28562600011870a26e97af1ae597a7ed2f4093fb261'
5
5
  SHA512:
6
- metadata.gz: 25e04a8a9fc1f6f904aa3922a21154aa6f1212a39605fae8f21a18ec43f4541c9399fa6405d29f65896e9ffd9a3dd50cc4dc3cccf5662f1ab7ecd075b67e86cc
7
- data.tar.gz: 961c8f33c689df07500a4bb47a5a76aebf5885c4d7fb5752536977af4def6f1a82be2329a6f0570ef96f89670d54f218a6ffa184bca83e0fefc47230dfd68ab2
6
+ metadata.gz: 42c3d04267709f5ebcaaf3ff743aed8b53bc537366158001ee46acb3f40f2e52cab2e2cc95f39614db82ee1392ff2a7cd9f7ea628f6344b17bcfee525a11a76c
7
+ data.tar.gz: ff70f30e8fc18fbe573789a65466c8a8159cdc63d4ff07edfb21df748db0642c68f5488363bbce59814dd555d4929a3478b4d8da308ef41c9ee3f01ac42fb491
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.42.0] - 2026-10-12
4
+
5
+ ### Added
6
+
7
+ * Report Test Impact Analysis skip counts on test suites ([#653][])
8
+
9
+ ### Fixed
10
+
11
+ * Fix Minitest tests discovery with Rails 8.1 deferred test loading for Test Parallelization feature ([#655][])
12
+ * Prevent reconfiguration from replacing live CI components ([#644][])
13
+
3
14
  ## [1.41.0] - 2026-10-05
4
15
 
5
16
  ### Fixed
@@ -737,7 +748,8 @@ Currently test suite level visibility is not used by our instrumentation: it wil
737
748
 
738
749
  - Ruby versions < 2.7 no longer supported ([#8][])
739
750
 
740
- [Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.41.0...main
751
+ [Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.42.0...main
752
+ [1.42.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.41.0...v1.42.0
741
753
  [1.41.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.40.0...v1.41.0
742
754
  [1.40.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.39.0...v1.40.0
743
755
  [1.39.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.38.1...v1.39.0
@@ -1042,4 +1054,7 @@ Currently test suite level visibility is not used by our instrumentation: it wil
1042
1054
  [#633]: https://github.com/DataDog/datadog-ci-rb/issues/633
1043
1055
  [#634]: https://github.com/DataDog/datadog-ci-rb/issues/634
1044
1056
  [#636]: https://github.com/DataDog/datadog-ci-rb/issues/636
1045
- [#645]: https://github.com/DataDog/datadog-ci-rb/issues/645
1057
+ [#644]: https://github.com/DataDog/datadog-ci-rb/issues/644
1058
+ [#645]: https://github.com/DataDog/datadog-ci-rb/issues/645
1059
+ [#653]: https://github.com/DataDog/datadog-ci-rb/issues/653
1060
+ [#655]: https://github.com/DataDog/datadog-ci-rb/issues/655
@@ -107,7 +107,8 @@ module Datadog
107
107
  # @type ivar @test_discovery: Datadog::CI::TestDiscovery::Component
108
108
  @test_discovery = TestDiscovery::Component.new(
109
109
  enabled: settings.ci.test_discovery_enabled,
110
- output_path: settings.ci.test_discovery_output_path
110
+ output_path: settings.ci.test_discovery_output_path,
111
+ minitest_plugin_autoload_enabled: settings.ci.minitest_no_plugins.nil?
111
112
  )
112
113
  @test_discovery.disable_features_for_test_discovery!(settings)
113
114
 
@@ -5,6 +5,7 @@ require "datadog/core/configuration/components"
5
5
 
6
6
  require_relative "settings"
7
7
  require_relative "components"
8
+ require_relative "reconfiguration"
8
9
 
9
10
  module Datadog
10
11
  module CI
@@ -14,6 +15,7 @@ module Datadog
14
15
  def self.activate!
15
16
  Core::Configuration::Settings.extend(CI::Configuration::Settings)
16
17
  Core::Configuration::Components.prepend(CI::Configuration::Components)
18
+ Datadog.singleton_class.prepend(CI::Configuration::Reconfiguration)
17
19
  end
18
20
  end
19
21
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datadog
4
+ module CI
5
+ module Configuration
6
+ # Replacing components during a test session discards its context and remote settings.
7
+ module Reconfiguration
8
+ def configure(&block)
9
+ current = components(allow_initialization: false)
10
+ if current&.test_tracing&.configuration_locked?
11
+ warn_about_ci_reconfiguration
12
+ return configuration
13
+ end
14
+
15
+ super
16
+ end
17
+
18
+ private
19
+
20
+ def warn_about_ci_reconfiguration
21
+ logger.warn(
22
+ "Datadog.configure ignored during an active Test Optimization session to preserve test context and remote settings. " \
23
+ "Move Datadog.configure calls before the test session starts."
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -235,6 +235,12 @@ module Datadog
235
235
  o.env CI::Ext::Settings::ENV_TEST_DISCOVERY_OUTPUT_PATH
236
236
  end
237
237
 
238
+ # Minitest treats any value, including "0", as disabling plugin auto-loading.
239
+ option :minitest_no_plugins do |o|
240
+ o.type :string, nilable: true
241
+ o.env "MT_NO_PLUGINS"
242
+ end
243
+
238
244
  option :test_optimization_cache_manifest_file do |o|
239
245
  o.type :string, nilable: true
240
246
  o.env CI::Ext::TestOptimizationCache::ENV_MANIFEST_FILE
@@ -60,8 +60,9 @@ module Datadog
60
60
  result
61
61
  end
62
62
 
63
- def run(*args)
63
+ def run(args = [])
64
64
  if datadog_configuration[:enabled] && test_discovery_component.enabled?
65
+ prepare_test_discovery(args)
65
66
  ::Minitest.seed = 1
66
67
  discover_tests
67
68
 
@@ -72,6 +73,18 @@ module Datadog
72
73
 
73
74
  private
74
75
 
76
+ def prepare_test_discovery(args)
77
+ args = args.dup
78
+ # Minitest 5 auto-loads plugins in run; Minitest 6 uses explicit loading.
79
+ unless ::Minitest.respond_to?(:load) || args.delete("--no-plugins") ||
80
+ !test_discovery_component.minitest_plugin_autoload_enabled?
81
+ ::Minitest.load_plugins
82
+ end
83
+
84
+ # Plugins may load tests while parsing arguments, before execution begins.
85
+ ::Minitest.process_args(args)
86
+ end
87
+
75
88
  def datadog_integration
76
89
  CI::Contrib::Instrumentation.fetch_integration(:minitest)
77
90
  end
@@ -13,10 +13,12 @@ module Datadog
13
13
  class Component
14
14
  def initialize(
15
15
  enabled:,
16
- output_path:
16
+ output_path:,
17
+ minitest_plugin_autoload_enabled: true
17
18
  )
18
19
  @enabled = enabled
19
20
  @output_path = output_path
21
+ @minitest_plugin_autoload_enabled = minitest_plugin_autoload_enabled
20
22
 
21
23
  @buffer = []
22
24
  @buffer_mutex = Mutex.new
@@ -30,6 +32,10 @@ module Datadog
30
32
  @enabled
31
33
  end
32
34
 
35
+ def minitest_plugin_autoload_enabled?
36
+ @minitest_plugin_autoload_enabled
37
+ end
38
+
33
39
  def disable_features_for_test_discovery!(settings)
34
40
  return unless @enabled
35
41
 
@@ -26,6 +26,10 @@ module Datadog
26
26
  def enabled?
27
27
  false
28
28
  end
29
+
30
+ def minitest_plugin_autoload_enabled?
31
+ true
32
+ end
29
33
  end
30
34
  end
31
35
  end
@@ -239,6 +239,7 @@ module Datadog
239
239
  Telemetry.itr_skipped
240
240
 
241
241
  context.incr_tests_skipped_by_tia_count
242
+ test.test_suite&.incr_tests_skipped_by_tia_count
242
243
  end
243
244
 
244
245
  # Handle code coverage
@@ -349,7 +350,17 @@ module Datadog
349
350
  end
350
351
 
351
352
  def on_test_suite_finished(test_suite, context)
352
- return unless enabled? && suite_skipping_mode?
353
+ return unless enabled?
354
+
355
+ skipped_count = if suite_skipping_mode?
356
+ test_suite.skipped_by_test_impact_analysis? ? 1 : 0
357
+ else
358
+ test_suite.tests_skipped_by_tia_count
359
+ end
360
+ test_suite.set_tag(Ext::Test::TAG_ITR_TESTS_SKIPPED, skipped_count.positive?.to_s)
361
+ test_suite.set_tag(Ext::Test::TAG_ITR_TEST_SKIPPING_COUNT, skipped_count)
362
+
363
+ return unless suite_skipping_mode?
353
364
 
354
365
  if test_suite.skipped_by_test_impact_analysis?
355
366
  Telemetry.itr_skipped
@@ -25,6 +25,7 @@ module Datadog
25
25
  # tracks final status for each test (the status that is reported after all retries):
26
26
  # { "MySuite.mytest.a:1" => "pass" }
27
27
  @final_statuses_per_test = {}
28
+ @tests_skipped_by_tia_count = 0
28
29
  end
29
30
 
30
31
  # Adds files that Test Impact Analysis should consider capable of
@@ -97,6 +98,16 @@ module Datadog
97
98
  end
98
99
  end
99
100
 
101
+ # @internal
102
+ def tests_skipped_by_tia_count
103
+ synchronize { @tests_skipped_by_tia_count }
104
+ end
105
+
106
+ # @internal
107
+ def incr_tests_skipped_by_tia_count
108
+ synchronize { @tests_skipped_by_tia_count += 1 }
109
+ end
110
+
100
111
  # @internal
101
112
  def record_test_result(test_id, datadog_test_status)
102
113
  synchronize do
@@ -59,6 +59,7 @@ module Datadog
59
59
  @codeowners = codeowners
60
60
  @logical_test_session_name = logical_test_session_name
61
61
  @trace_setup_teardown_enabled = trace_setup_teardown_enabled
62
+ @configuration_locked = false
62
63
 
63
64
  # "Known tests" feature fetches a list of all tests known to Datadog for this repository
64
65
  # and uses this list to determine if a test is new or not. New tests are marked with "test.is_new" tag.
@@ -94,6 +95,8 @@ module Datadog
94
95
  end
95
96
 
96
97
  def start_test_session(service: nil, tags: {}, estimated_total_tests_count: 0, distributed: nil, local_test_suites_mode: true)
98
+ # Forks inherit this flag; fresh workers acquire it when joining the distributed session.
99
+ @configuration_locked = true
97
100
  @local_test_suites_mode = local_test_suites_mode
98
101
 
99
102
  start_drb_service
@@ -167,6 +170,10 @@ module Datadog
167
170
  maybe_remote_context.any_tests_started?
168
171
  end
169
172
 
173
+ def configuration_locked?
174
+ @configuration_locked
175
+ end
176
+
170
177
  def active_test_session
171
178
  maybe_remote_context.active_test_session
172
179
  rescue => e
@@ -204,6 +211,10 @@ module Datadog
204
211
  on_test_session_finished(test_session) if test_session
205
212
 
206
213
  @context.deactivate_test_session
214
+ # Only the session owner can release the lock. Distributed workers retain their
215
+ # remote feature state for their lifetime, including after the parent's session ends.
216
+ @configuration_locked = false unless client_process?
217
+ nil
207
218
  end
208
219
 
209
220
  def deactivate_test_module
@@ -51,6 +51,10 @@ module Datadog
51
51
  false
52
52
  end
53
53
 
54
+ def configuration_locked?
55
+ false
56
+ end
57
+
54
58
  def active_test_session
55
59
  end
56
60
 
@@ -4,7 +4,7 @@ module Datadog
4
4
  module CI
5
5
  module VERSION
6
6
  MAJOR = 1
7
- MINOR = 41
7
+ MINOR = 42
8
8
  PATCH = 0
9
9
  PRE = nil
10
10
  BUILD = nil
data/lib/datadog/ci.rb CHANGED
@@ -24,6 +24,9 @@ module Datadog
24
24
  #
25
25
  # Returns the existing test session if one is already active. There is at most a single test session per process.
26
26
  #
27
+ # Complete all `Datadog.configure` calls before starting the session.
28
+ # Concurrent configuration and session startup are unsupported.
29
+ #
27
30
  # The {.start_test_session} method is used to mark the start of the test session:
28
31
  # ```
29
32
  # Datadog::CI.start_test_session(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.41.0
4
+ version: 1.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
@@ -100,6 +100,7 @@ files:
100
100
  - lib/datadog/ci/concurrent_span.rb
101
101
  - lib/datadog/ci/configuration/components.rb
102
102
  - lib/datadog/ci/configuration/extensions.rb
103
+ - lib/datadog/ci/configuration/reconfiguration.rb
103
104
  - lib/datadog/ci/configuration/settings.rb
104
105
  - lib/datadog/ci/configuration/tracing_compatibility.rb
105
106
  - lib/datadog/ci/contrib/activesupport/configuration/settings.rb