datadog-ci 1.40.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 +4 -4
- data/CHANGELOG.md +26 -1
- data/lib/datadog/ci/configuration/components.rb +2 -1
- data/lib/datadog/ci/configuration/extensions.rb +2 -0
- data/lib/datadog/ci/configuration/reconfiguration.rb +29 -0
- data/lib/datadog/ci/configuration/settings.rb +6 -0
- data/lib/datadog/ci/contrib/minitest/reporter.rb +13 -4
- data/lib/datadog/ci/contrib/minitest/runner.rb +14 -1
- data/lib/datadog/ci/test_discovery/component.rb +7 -1
- data/lib/datadog/ci/test_discovery/null_component.rb +4 -0
- data/lib/datadog/ci/test_impact_analysis/component.rb +12 -1
- data/lib/datadog/ci/test_retries/component.rb +6 -0
- data/lib/datadog/ci/test_suite.rb +11 -0
- data/lib/datadog/ci/test_tracing/component.rb +14 -0
- data/lib/datadog/ci/test_tracing/null_component.rb +4 -0
- data/lib/datadog/ci/version.rb +1 -1
- data/lib/datadog/ci.rb +3 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a8c5bcf57d8d00cf4b72205835c2bcfa651cf5dbb8146bc080d0beca7a3cc72
|
|
4
|
+
data.tar.gz: '029e12e12d747a2854a8b28562600011870a26e97af1ae597a7ed2f4093fb261'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42c3d04267709f5ebcaaf3ff743aed8b53bc537366158001ee46acb3f40f2e52cab2e2cc95f39614db82ee1392ff2a7cd9f7ea628f6344b17bcfee525a11a76c
|
|
7
|
+
data.tar.gz: ff70f30e8fc18fbe573789a65466c8a8159cdc63d4ff07edfb21df748db0642c68f5488363bbce59814dd555d4929a3478b4d8da308ef41c9ee3f01ac42fb491
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
14
|
+
## [1.41.0] - 2026-10-05
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
* Stop retries when no test session is active ([#645][])
|
|
19
|
+
* Fix Minitest sessions with no executed tests ([#636][])
|
|
20
|
+
|
|
3
21
|
## [1.40.0] - 2026-09-28
|
|
4
22
|
|
|
5
23
|
### Changed
|
|
@@ -730,7 +748,9 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
|
730
748
|
|
|
731
749
|
- Ruby versions < 2.7 no longer supported ([#8][])
|
|
732
750
|
|
|
733
|
-
[Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.
|
|
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
|
|
753
|
+
[1.41.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.40.0...v1.41.0
|
|
734
754
|
[1.40.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.39.0...v1.40.0
|
|
735
755
|
[1.39.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.38.1...v1.39.0
|
|
736
756
|
[1.38.1]: https://github.com/DataDog/datadog-ci-rb/compare/v1.38.0...v1.38.1
|
|
@@ -1033,3 +1053,8 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
|
1033
1053
|
[#619]: https://github.com/DataDog/datadog-ci-rb/issues/619
|
|
1034
1054
|
[#633]: https://github.com/DataDog/datadog-ci-rb/issues/633
|
|
1035
1055
|
[#634]: https://github.com/DataDog/datadog-ci-rb/issues/634
|
|
1056
|
+
[#636]: https://github.com/DataDog/datadog-ci-rb/issues/636
|
|
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
|
|
@@ -23,12 +23,17 @@ module Datadog
|
|
|
23
23
|
|
|
24
24
|
return res if active_test_session.nil? || active_test_module.nil?
|
|
25
25
|
|
|
26
|
-
if passed?
|
|
27
|
-
active_test_module.passed!
|
|
28
|
-
active_test_session.passed!
|
|
29
|
-
else
|
|
26
|
+
if !passed?
|
|
30
27
|
active_test_module.failed!
|
|
31
28
|
active_test_session.failed!
|
|
29
|
+
elsif !test_tracing_component.any_tests_started?
|
|
30
|
+
active_test_module.skipped!(reason: "No tests were executed")
|
|
31
|
+
active_test_session.skipped!(reason: "No tests were executed")
|
|
32
|
+
active_test_module.set_tag(CI::Ext::Test::TAG_SESSION_EMPTY_REASON, "zero_tests")
|
|
33
|
+
active_test_session.set_tag(CI::Ext::Test::TAG_SESSION_EMPTY_REASON, "zero_tests")
|
|
34
|
+
else
|
|
35
|
+
active_test_module.passed!
|
|
36
|
+
active_test_session.passed!
|
|
32
37
|
end
|
|
33
38
|
|
|
34
39
|
active_test_module.finish
|
|
@@ -39,6 +44,10 @@ module Datadog
|
|
|
39
44
|
|
|
40
45
|
private
|
|
41
46
|
|
|
47
|
+
def test_tracing_component
|
|
48
|
+
Datadog.send(:components).test_tracing
|
|
49
|
+
end
|
|
50
|
+
|
|
42
51
|
def datadog_configuration
|
|
43
52
|
Datadog.configuration.ci[:minitest]
|
|
44
53
|
end
|
|
@@ -60,8 +60,9 @@ module Datadog
|
|
|
60
60
|
result
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
def run(
|
|
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
|
|
|
@@ -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?
|
|
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
|
|
@@ -147,11 +147,17 @@ module Datadog
|
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def should_retry?
|
|
150
|
+
return false unless test_tracing.active_test_session
|
|
151
|
+
|
|
150
152
|
!!current_retry_driver&.should_retry?
|
|
151
153
|
end
|
|
152
154
|
|
|
153
155
|
private
|
|
154
156
|
|
|
157
|
+
def test_tracing
|
|
158
|
+
Datadog.send(:components).test_tracing
|
|
159
|
+
end
|
|
160
|
+
|
|
155
161
|
def current_retry_driver
|
|
156
162
|
Thread.current[FIBER_LOCAL_CURRENT_RETRY_DRIVER_KEY]
|
|
157
163
|
end
|
|
@@ -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,8 +170,15 @@ 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
|
|
179
|
+
rescue => e
|
|
180
|
+
Datadog.logger.error("Failed to get active test session: #{e.class}: #{e.message}")
|
|
181
|
+
nil
|
|
172
182
|
end
|
|
173
183
|
|
|
174
184
|
def active_test_module
|
|
@@ -201,6 +211,10 @@ module Datadog
|
|
|
201
211
|
on_test_session_finished(test_session) if test_session
|
|
202
212
|
|
|
203
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
|
|
204
218
|
end
|
|
205
219
|
|
|
206
220
|
def deactivate_test_module
|
data/lib/datadog/ci/version.rb
CHANGED
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.
|
|
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
|