datadog-ci 1.23.1 → 1.23.3
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 +25 -2
- data/lib/datadog/ci/configuration/components.rb +16 -11
- data/lib/datadog/ci/contrib/minitest/helpers.rb +10 -6
- data/lib/datadog/ci/contrib/minitest/runner.rb +37 -0
- data/lib/datadog/ci/contrib/rspec/example.rb +36 -32
- data/lib/datadog/ci/contrib/rspec/integration.rb +1 -4
- data/lib/datadog/ci/contrib/rspec/runner.rb +35 -1
- data/lib/datadog/ci/ext/test.rb +1 -1
- data/lib/datadog/ci/git/tree_uploader.rb +6 -0
- data/lib/datadog/ci/impacted_tests_detection/null_component.rb +24 -0
- data/lib/datadog/ci/remote/null_component.rb +13 -0
- data/lib/datadog/ci/test.rb +8 -14
- data/lib/datadog/ci/test_discovery/component.rb +8 -14
- data/lib/datadog/ci/test_discovery/null_component.rb +32 -0
- data/lib/datadog/ci/test_optimisation/null_component.rb +66 -0
- data/lib/datadog/ci/test_optimisation/skippable_percentage/calculator.rb +5 -0
- data/lib/datadog/ci/test_optimisation/skippable_percentage/estimator.rb +5 -0
- data/lib/datadog/ci/test_visibility/component.rb +0 -6
- data/lib/datadog/ci/utils/stateful.rb +2 -1
- data/lib/datadog/ci/utils/test_run.rb +6 -0
- data/lib/datadog/ci/version.rb +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a911ce98b1577d684374a00e8efd9ecbcf34fac28f24bb543411dbb762163d8c
|
|
4
|
+
data.tar.gz: 93c277bf2fc40ccdede20e48102eb6b1c1721336d80b62e60c9a191b807f8754
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb8fef68d0b4e9e6dc02aa76c603b98e854b09ef47913c30c986d4e397e9b48c79ec14d5ebb9dd1e48db0737def7d73f7e33aefbb35039441e65b4005884051a
|
|
7
|
+
data.tar.gz: 072aa07eb4af30102c588a54c75398634e1b409cd1698a087b8e0cb030bc6bb6c5bd8b98ba2c57716e8d819b61ace6ed9ed4ea39a5eda0e1accedc0e232a1eaf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.23.3] - 2025-11-19
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
* Fix nil error for test discovery component by introducing NullObject pattern for all components of Datadog Test Optimization ([#430][])
|
|
8
|
+
|
|
9
|
+
## [1.23.2] - 2025-11-18
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
* Test discovery mode for minitest ([#418][])
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
* DDTest integration, tests discovery: change format of tests.json file ([#416][])
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
* Fix: rename wrong test.retry_reason value for Auto Test Retries feature ([#425][])
|
|
19
|
+
|
|
3
20
|
## [1.23.1] - 2025-10-14
|
|
4
21
|
|
|
5
22
|
========== Changelog ==========
|
|
@@ -537,7 +554,9 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
|
537
554
|
|
|
538
555
|
- Ruby versions < 2.7 no longer supported ([#8][])
|
|
539
556
|
|
|
540
|
-
[Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.23.
|
|
557
|
+
[Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.23.3...main
|
|
558
|
+
[1.23.3]: https://github.com/DataDog/datadog-ci-rb/compare/v1.23.2...v1.23.3
|
|
559
|
+
[1.23.2]: https://github.com/DataDog/datadog-ci-rb/compare/v1.23.1...v1.23.2
|
|
541
560
|
[1.23.1]: https://github.com/DataDog/datadog-ci-rb/compare/v1.23.0...v1.23.1
|
|
542
561
|
[1.23.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.22.1...v1.23.0
|
|
543
562
|
[1.22.1]: https://github.com/DataDog/datadog-ci-rb/compare/v1.22.0...v1.22.1
|
|
@@ -763,4 +782,8 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
|
763
782
|
[#402]: https://github.com/DataDog/datadog-ci-rb/issues/402
|
|
764
783
|
[#407]: https://github.com/DataDog/datadog-ci-rb/issues/407
|
|
765
784
|
[#410]: https://github.com/DataDog/datadog-ci-rb/issues/410
|
|
766
|
-
[#414]: https://github.com/DataDog/datadog-ci-rb/issues/414
|
|
785
|
+
[#414]: https://github.com/DataDog/datadog-ci-rb/issues/414
|
|
786
|
+
[#416]: https://github.com/DataDog/datadog-ci-rb/issues/416
|
|
787
|
+
[#418]: https://github.com/DataDog/datadog-ci-rb/issues/418
|
|
788
|
+
[#425]: https://github.com/DataDog/datadog-ci-rb/issues/425
|
|
789
|
+
[#430]: https://github.com/DataDog/datadog-ci-rb/issues/430
|
|
@@ -5,18 +5,22 @@ require "datadog/core/telemetry/ext"
|
|
|
5
5
|
require_relative "../ext/settings"
|
|
6
6
|
require_relative "../git/tree_uploader"
|
|
7
7
|
require_relative "../impacted_tests_detection/component"
|
|
8
|
+
require_relative "../impacted_tests_detection/null_component"
|
|
8
9
|
require_relative "../logs/component"
|
|
9
10
|
require_relative "../logs/transport"
|
|
11
|
+
require_relative "../remote/null_component"
|
|
10
12
|
require_relative "../remote/component"
|
|
11
13
|
require_relative "../remote/library_settings_client"
|
|
12
14
|
require_relative "../test_management/component"
|
|
13
15
|
require_relative "../test_management/null_component"
|
|
14
16
|
require_relative "../test_management/tests_properties"
|
|
17
|
+
require_relative "../test_optimisation/null_component"
|
|
15
18
|
require_relative "../test_optimisation/component"
|
|
16
19
|
require_relative "../test_optimisation/coverage/transport"
|
|
17
20
|
require_relative "../test_retries/component"
|
|
18
21
|
require_relative "../test_retries/null_component"
|
|
19
22
|
require_relative "../test_discovery/component"
|
|
23
|
+
require_relative "../test_discovery/null_component"
|
|
20
24
|
require_relative "../test_visibility/component"
|
|
21
25
|
require_relative "../test_visibility/flush"
|
|
22
26
|
require_relative "../test_visibility/known_tests"
|
|
@@ -41,14 +45,14 @@ module Datadog
|
|
|
41
45
|
:test_management, :agentless_logs_submission, :impacted_tests_detection, :test_discovery
|
|
42
46
|
|
|
43
47
|
def initialize(settings)
|
|
44
|
-
@test_optimisation =
|
|
48
|
+
@test_optimisation = TestOptimisation::NullComponent.new
|
|
45
49
|
@test_visibility = TestVisibility::NullComponent.new
|
|
46
50
|
@git_tree_upload_worker = DummyWorker.new
|
|
47
|
-
@ci_remote =
|
|
51
|
+
@ci_remote = Remote::NullComponent.new
|
|
48
52
|
@test_retries = TestRetries::NullComponent.new
|
|
49
53
|
@test_management = TestManagement::NullComponent.new
|
|
50
|
-
@impacted_tests_detection =
|
|
51
|
-
@test_discovery =
|
|
54
|
+
@impacted_tests_detection = ImpactedTestsDetection::NullComponent.new
|
|
55
|
+
@test_discovery = TestDiscovery::NullComponent.new
|
|
52
56
|
|
|
53
57
|
# Activate CI mode if enabled
|
|
54
58
|
if settings.ci.enabled
|
|
@@ -96,6 +100,14 @@ module Datadog
|
|
|
96
100
|
# timecop configuration
|
|
97
101
|
configure_time_providers(settings)
|
|
98
102
|
|
|
103
|
+
# first check if we are in test discovery mode and configure library accordingly
|
|
104
|
+
# @type ivar @test_discovery: Datadog::CI::TestDiscovery::Component
|
|
105
|
+
@test_discovery = TestDiscovery::Component.new(
|
|
106
|
+
enabled: settings.ci.test_discovery_enabled,
|
|
107
|
+
output_path: settings.ci.test_discovery_output_path
|
|
108
|
+
)
|
|
109
|
+
@test_discovery.disable_features_for_test_discovery!(settings)
|
|
110
|
+
|
|
99
111
|
# Configure Datadog::Tracing module
|
|
100
112
|
|
|
101
113
|
# No need not use 128-bit trace ids for test visibility,
|
|
@@ -115,13 +127,6 @@ module Datadog
|
|
|
115
127
|
|
|
116
128
|
settings.tracing.test_mode.writer_options = trace_writer_options
|
|
117
129
|
|
|
118
|
-
# @type ivar @test_discovery: Datadog::CI::TestDiscovery::Component
|
|
119
|
-
@test_discovery = TestDiscovery::Component.new(
|
|
120
|
-
enabled: settings.ci.test_discovery_enabled,
|
|
121
|
-
output_path: settings.ci.test_discovery_output_path
|
|
122
|
-
)
|
|
123
|
-
@test_discovery.disable_features_for_test_discovery!(settings)
|
|
124
|
-
|
|
125
130
|
@git_tree_upload_worker = build_git_upload_worker(settings, test_visibility_api)
|
|
126
131
|
@ci_remote = Remote::Component.new(
|
|
127
132
|
library_settings_client: build_library_settings_client(settings, test_visibility_api),
|
|
@@ -10,7 +10,7 @@ module Datadog
|
|
|
10
10
|
return nil if method.nil?
|
|
11
11
|
|
|
12
12
|
test_suite_name = test_suite_name(klass, method)
|
|
13
|
-
source_file, line_number =
|
|
13
|
+
source_file, line_number = extract_runnable_source_location(klass, method)
|
|
14
14
|
|
|
15
15
|
test_suite_tags = if source_file
|
|
16
16
|
{
|
|
@@ -32,11 +32,7 @@ module Datadog
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def self.test_suite_name(klass, method_name)
|
|
35
|
-
source_location =
|
|
36
|
-
# if we are in anonymous class, fallback to the method source location
|
|
37
|
-
if source_location.nil?
|
|
38
|
-
source_location, = klass.instance_method(method_name).source_location
|
|
39
|
-
end
|
|
35
|
+
source_location = extract_runnable_source_location(klass, method_name)&.first
|
|
40
36
|
|
|
41
37
|
# According to https://github.com/DataDog/datadog-ci-rb/issues/386
|
|
42
38
|
# the source file path coould be relative when using minitest mixins.
|
|
@@ -54,6 +50,14 @@ module Datadog
|
|
|
54
50
|
"#{klass.name} at #{source_file_path}"
|
|
55
51
|
end
|
|
56
52
|
|
|
53
|
+
def self.extract_runnable_source_location(klass, method_name)
|
|
54
|
+
source_location = extract_source_location_from_class(klass)
|
|
55
|
+
if source_location.nil? || source_location.empty?
|
|
56
|
+
return klass.instance_method(method_name).source_location
|
|
57
|
+
end
|
|
58
|
+
source_location
|
|
59
|
+
end
|
|
60
|
+
|
|
57
61
|
def self.parallel?(klass)
|
|
58
62
|
klass.ancestors.include?(::Minitest::Parallel::Test) ||
|
|
59
63
|
(defined?(::Minitest::Queue) && ::Minitest.singleton_class.ancestors.include?(::Minitest::Queue))
|
|
@@ -54,6 +54,16 @@ module Datadog
|
|
|
54
54
|
result
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
def run(*args)
|
|
58
|
+
if datadog_configuration[:enabled] && test_discovery_component.enabled?
|
|
59
|
+
::Minitest.seed = 1
|
|
60
|
+
discover_tests
|
|
61
|
+
|
|
62
|
+
return true
|
|
63
|
+
end
|
|
64
|
+
super
|
|
65
|
+
end
|
|
66
|
+
|
|
57
67
|
private
|
|
58
68
|
|
|
59
69
|
def datadog_integration
|
|
@@ -71,6 +81,33 @@ module Datadog
|
|
|
71
81
|
def test_retries_component
|
|
72
82
|
Datadog.send(:components).test_retries
|
|
73
83
|
end
|
|
84
|
+
|
|
85
|
+
def test_discovery_component
|
|
86
|
+
Datadog.send(:components).test_discovery
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def discover_tests
|
|
90
|
+
test_discovery_component.start
|
|
91
|
+
|
|
92
|
+
::Minitest::Runnable.runnables.each do |test_class|
|
|
93
|
+
test_class.runnable_methods.each do |test_method|
|
|
94
|
+
test_suite_name = Helpers.test_suite_name(test_class, test_method)
|
|
95
|
+
|
|
96
|
+
source_path = Helpers.extract_runnable_source_location(test_class, test_method)&.first
|
|
97
|
+
source_path = Git::LocalRepository.relative_to_root(source_path) if source_path
|
|
98
|
+
|
|
99
|
+
test_discovery_component.record_test(
|
|
100
|
+
name: test_method,
|
|
101
|
+
suite: test_suite_name,
|
|
102
|
+
parameters: nil,
|
|
103
|
+
module_name: Ext::FRAMEWORK,
|
|
104
|
+
source_file: source_path
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
test_discovery_component.finish
|
|
110
|
+
end
|
|
74
111
|
end
|
|
75
112
|
end
|
|
76
113
|
end
|
|
@@ -19,8 +19,8 @@ module Datadog
|
|
|
19
19
|
|
|
20
20
|
module InstanceMethods
|
|
21
21
|
def run(*args)
|
|
22
|
-
return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
|
|
23
22
|
return super unless datadog_configuration[:enabled]
|
|
23
|
+
return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
|
|
24
24
|
|
|
25
25
|
test_suite_span = test_visibility_component.start_test_suite(datadog_test_suite_name) if ci_queue?
|
|
26
26
|
|
|
@@ -129,37 +129,6 @@ module Datadog
|
|
|
129
129
|
)
|
|
130
130
|
end
|
|
131
131
|
|
|
132
|
-
def datadog_unskippable?
|
|
133
|
-
!!metadata[CI::Ext::Test::ITR_UNSKIPPABLE_OPTION]
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
private
|
|
137
|
-
|
|
138
|
-
def fetch_top_level_example_group
|
|
139
|
-
example_group = metadata[:example_group]
|
|
140
|
-
parent_example_group = example_group[:parent_example_group]
|
|
141
|
-
|
|
142
|
-
return example_group unless parent_example_group
|
|
143
|
-
|
|
144
|
-
res = parent_example_group
|
|
145
|
-
while (parent = res[:parent_example_group])
|
|
146
|
-
res = parent
|
|
147
|
-
end
|
|
148
|
-
res
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def datadog_integration
|
|
152
|
-
CI::Contrib::Instrumentation.fetch_integration(:rspec)
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
def datadog_configuration
|
|
156
|
-
Datadog.configuration.ci[:rspec]
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def datadog_test_suite_description
|
|
160
|
-
@datadog_test_suite_description ||= fetch_top_level_example_group[:description]
|
|
161
|
-
end
|
|
162
|
-
|
|
163
132
|
def datadog_test_name
|
|
164
133
|
return @datadog_test_name if defined?(@datadog_test_name)
|
|
165
134
|
|
|
@@ -195,6 +164,41 @@ module Datadog
|
|
|
195
164
|
)
|
|
196
165
|
end
|
|
197
166
|
|
|
167
|
+
def datadog_unskippable?
|
|
168
|
+
!!metadata[CI::Ext::Test::ITR_UNSKIPPABLE_OPTION]
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def datadog_test_suite_source_file_path
|
|
172
|
+
Git::LocalRepository.relative_to_root(metadata[:rerun_file_path])
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
private
|
|
176
|
+
|
|
177
|
+
def fetch_top_level_example_group
|
|
178
|
+
example_group = metadata[:example_group]
|
|
179
|
+
parent_example_group = example_group[:parent_example_group]
|
|
180
|
+
|
|
181
|
+
return example_group unless parent_example_group
|
|
182
|
+
|
|
183
|
+
res = parent_example_group
|
|
184
|
+
while (parent = res[:parent_example_group])
|
|
185
|
+
res = parent
|
|
186
|
+
end
|
|
187
|
+
res
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def datadog_integration
|
|
191
|
+
CI::Contrib::Instrumentation.fetch_integration(:rspec)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def datadog_configuration
|
|
195
|
+
Datadog.configuration.ci[:rspec]
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def datadog_test_suite_description
|
|
199
|
+
@datadog_test_suite_description ||= fetch_top_level_example_group[:description]
|
|
200
|
+
end
|
|
201
|
+
|
|
198
202
|
def test_visibility_component
|
|
199
203
|
Datadog.send(:components).test_visibility
|
|
200
204
|
end
|
|
@@ -32,10 +32,7 @@ module Datadog
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def new_configuration
|
|
35
|
-
|
|
36
|
-
# if we are running in test discovery mode, we are most likely running in dry run - we need to allow it
|
|
37
|
-
settings.dry_run_enabled = true if test_discovery_component&.enabled?
|
|
38
|
-
settings
|
|
35
|
+
Configuration::Settings.new
|
|
39
36
|
end
|
|
40
37
|
|
|
41
38
|
def patcher
|
|
@@ -16,9 +16,19 @@ module Datadog
|
|
|
16
16
|
|
|
17
17
|
module InstanceMethods
|
|
18
18
|
def run_specs(*args)
|
|
19
|
-
return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
|
|
20
19
|
return super unless datadog_configuration[:enabled]
|
|
21
20
|
|
|
21
|
+
discovery_component = test_discovery_component
|
|
22
|
+
|
|
23
|
+
if discovery_component&.enabled?
|
|
24
|
+
discover_tests(discovery_component)
|
|
25
|
+
|
|
26
|
+
# don't run the tests, we just needed to discover them and now we can return
|
|
27
|
+
return
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
|
|
31
|
+
|
|
22
32
|
test_session = test_visibility_component.start_test_session(
|
|
23
33
|
tags: {
|
|
24
34
|
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
|
|
@@ -61,6 +71,30 @@ module Datadog
|
|
|
61
71
|
def test_visibility_component
|
|
62
72
|
Datadog.send(:components).test_visibility
|
|
63
73
|
end
|
|
74
|
+
|
|
75
|
+
def test_discovery_component
|
|
76
|
+
Datadog.send(:components).test_discovery
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def discover_tests(component)
|
|
80
|
+
component.start
|
|
81
|
+
|
|
82
|
+
examples = ::RSpec.world.all_examples
|
|
83
|
+
|
|
84
|
+
examples.each do |example|
|
|
85
|
+
next if example.metadata[:skip]
|
|
86
|
+
|
|
87
|
+
component.record_test(
|
|
88
|
+
name: example.datadog_test_name,
|
|
89
|
+
suite: example.datadog_test_suite_name,
|
|
90
|
+
parameters: example.datadog_test_parameters,
|
|
91
|
+
module_name: Ext::FRAMEWORK,
|
|
92
|
+
source_file: example.datadog_test_suite_source_file_path
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
component.finish
|
|
97
|
+
end
|
|
64
98
|
end
|
|
65
99
|
end
|
|
66
100
|
end
|
data/lib/datadog/ci/ext/test.rb
CHANGED
|
@@ -156,7 +156,7 @@ module Datadog
|
|
|
156
156
|
# possible reasons why a test was retried
|
|
157
157
|
module RetryReason
|
|
158
158
|
RETRY_DETECT_FLAKY = "early_flake_detection"
|
|
159
|
-
RETRY_FAILED = "
|
|
159
|
+
RETRY_FAILED = "auto_test_retry"
|
|
160
160
|
RETRY_FLAKY_FIXED = "attempt_to_fix"
|
|
161
161
|
RETRY_EXTERNAL = "external"
|
|
162
162
|
|
|
@@ -10,6 +10,7 @@ require_relative "packfiles"
|
|
|
10
10
|
|
|
11
11
|
require_relative "../ext/telemetry"
|
|
12
12
|
require_relative "../utils/telemetry"
|
|
13
|
+
require_relative "../utils/test_run"
|
|
13
14
|
|
|
14
15
|
module Datadog
|
|
15
16
|
module CI
|
|
@@ -33,6 +34,11 @@ module Datadog
|
|
|
33
34
|
return
|
|
34
35
|
end
|
|
35
36
|
|
|
37
|
+
if Utils::TestRun.test_optimization_data_cached?
|
|
38
|
+
Datadog.logger.debug("DDTest cache found, git upload already done by DDTest tool, skipping git upload")
|
|
39
|
+
return
|
|
40
|
+
end
|
|
41
|
+
|
|
36
42
|
Datadog.logger.debug { "Uploading git tree for repository #{repository_url}" }
|
|
37
43
|
|
|
38
44
|
latest_commits = LocalRepository.git_commits
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Datadog
|
|
4
|
+
module CI
|
|
5
|
+
module ImpactedTestsDetection
|
|
6
|
+
# Null object used when impacted tests detection is unavailable
|
|
7
|
+
class NullComponent
|
|
8
|
+
def configure(_library_settings = nil, _test_session = nil)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def enabled?
|
|
12
|
+
false
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def modified?(_test_span)
|
|
16
|
+
false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def tag_modified_test(_test_span)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/datadog/ci/test.rb
CHANGED
|
@@ -60,6 +60,12 @@ module Datadog
|
|
|
60
60
|
get_tag(Ext::Test::TAG_TEST_MODULE_ID)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
# Name of the running test module this test belongs to.
|
|
64
|
+
# @return [String] the name of the test module.
|
|
65
|
+
def test_module_name
|
|
66
|
+
get_tag(Ext::Test::TAG_MODULE)
|
|
67
|
+
end
|
|
68
|
+
|
|
63
69
|
# Span id of the running test session this test belongs to.
|
|
64
70
|
# @return [String] the span id of the test session.
|
|
65
71
|
def test_session_id
|
|
@@ -216,9 +222,7 @@ module Datadog
|
|
|
216
222
|
|
|
217
223
|
# @internal
|
|
218
224
|
def datadog_skip_reason
|
|
219
|
-
if
|
|
220
|
-
Ext::Test::SkipReason::TEST_DISCOVERY_MODE
|
|
221
|
-
elsif skipped_by_test_impact_analysis?
|
|
225
|
+
if skipped_by_test_impact_analysis?
|
|
222
226
|
Ext::Test::SkipReason::TEST_IMPACT_ANALYSIS
|
|
223
227
|
elsif disabled? || quarantined?
|
|
224
228
|
Ext::Test::SkipReason::TEST_MANAGEMENT_DISABLED
|
|
@@ -227,7 +231,7 @@ module Datadog
|
|
|
227
231
|
|
|
228
232
|
# @internal
|
|
229
233
|
def should_skip?
|
|
230
|
-
|
|
234
|
+
skipped_by_test_impact_analysis? || (disabled? && !attempt_to_fix?)
|
|
231
235
|
end
|
|
232
236
|
|
|
233
237
|
# @internal
|
|
@@ -240,16 +244,6 @@ module Datadog
|
|
|
240
244
|
get_tag(Ext::Test::TAG_ITR_SKIPPED_BY_ITR) == "true"
|
|
241
245
|
end
|
|
242
246
|
|
|
243
|
-
# @internal
|
|
244
|
-
def in_test_discovery_mode?
|
|
245
|
-
!!@in_test_discovery_mode
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
# @internal
|
|
249
|
-
def mark_test_discovery_mode!
|
|
250
|
-
@in_test_discovery_mode = true
|
|
251
|
-
end
|
|
252
|
-
|
|
253
247
|
private
|
|
254
248
|
|
|
255
249
|
def record_test_result(datadog_status)
|
|
@@ -48,7 +48,7 @@ module Datadog
|
|
|
48
48
|
settings.ci.impacted_tests_detection_enabled = false
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
def
|
|
51
|
+
def start
|
|
52
52
|
return unless @enabled
|
|
53
53
|
|
|
54
54
|
if @output_path.nil? || @output_path&.empty?
|
|
@@ -67,7 +67,7 @@ module Datadog
|
|
|
67
67
|
@buffer_mutex.synchronize { @buffer.clear }
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
def
|
|
70
|
+
def finish
|
|
71
71
|
return unless @enabled
|
|
72
72
|
|
|
73
73
|
@buffer_mutex.synchronize do
|
|
@@ -75,19 +75,13 @@ module Datadog
|
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
def
|
|
79
|
-
return unless @enabled
|
|
80
|
-
|
|
81
|
-
# Mark test as being in test discovery mode so it will be skipped
|
|
82
|
-
# even if we are not running in dry run mode.
|
|
83
|
-
test.mark_test_discovery_mode!
|
|
84
|
-
|
|
78
|
+
def record_test(name:, suite:, module_name:, parameters:, source_file:)
|
|
85
79
|
test_info = {
|
|
86
|
-
"name" =>
|
|
87
|
-
"suite" =>
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
80
|
+
"name" => name,
|
|
81
|
+
"suite" => suite,
|
|
82
|
+
"module" => module_name,
|
|
83
|
+
"parameters" => parameters,
|
|
84
|
+
"suiteSourceFile" => source_file
|
|
91
85
|
}
|
|
92
86
|
|
|
93
87
|
Datadog.logger.debug { "Discovered test: #{test_info}" }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Datadog
|
|
4
|
+
module CI
|
|
5
|
+
module TestDiscovery
|
|
6
|
+
# Null object used when test discovery component is unavailable
|
|
7
|
+
class NullComponent
|
|
8
|
+
def configure(_library_settings = nil, _test_session = nil)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def disable_features_for_test_discovery!(_settings = nil)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def start
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def finish
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def record_test(name:, suite:, module_name:, parameters:, source_file:)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def shutdown!
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def enabled?
|
|
27
|
+
false
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "set"
|
|
4
|
+
|
|
5
|
+
module Datadog
|
|
6
|
+
module CI
|
|
7
|
+
module TestOptimisation
|
|
8
|
+
# No-op implementation used when test optimisation is disabled.
|
|
9
|
+
class NullComponent
|
|
10
|
+
attr_reader :enabled, :skippable_tests_fetch_error, :test_skipping_enabled,
|
|
11
|
+
:code_coverage_enabled, :skippable_tests, :correlation_id
|
|
12
|
+
|
|
13
|
+
def initialize
|
|
14
|
+
@enabled = false
|
|
15
|
+
@test_skipping_enabled = false
|
|
16
|
+
@code_coverage_enabled = false
|
|
17
|
+
@skippable_tests_fetch_error = nil
|
|
18
|
+
@skippable_tests = Set.new
|
|
19
|
+
@correlation_id = nil
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def configure(_remote_configuration = nil, _test_session = nil)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def enabled?
|
|
26
|
+
false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def skipping_tests?
|
|
30
|
+
false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def code_coverage?
|
|
34
|
+
false
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def start_coverage(_test)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def stop_coverage(_test)
|
|
41
|
+
nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def mark_if_skippable(_test)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def skippable?(_datadog_test_id)
|
|
48
|
+
false
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def on_test_finished(_test, _context)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def write_test_session_tags(_test_session, _skipped_tests_count)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def skippable_tests_count
|
|
58
|
+
0
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def shutdown!
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -20,6 +20,11 @@ module Datadog
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def call
|
|
23
|
+
Datadog::Core.log_deprecation do
|
|
24
|
+
"Skippable percentage command is deprecated and will be removed in 2.0. Use DDTest tool instead." \
|
|
25
|
+
"More information: https://github.com/DataDog/ddtest "
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
return 0.0 if @failed
|
|
24
29
|
|
|
25
30
|
require_rspec!
|
|
@@ -24,6 +24,11 @@ module Datadog
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def call
|
|
27
|
+
Datadog::Core.log_deprecation do
|
|
28
|
+
"Skippable percentage command is deprecated and will be removed in 2.0. Use DDTest tool instead." \
|
|
29
|
+
"More information: https://github.com/DataDog/ddtest "
|
|
30
|
+
end
|
|
31
|
+
|
|
27
32
|
return 0.0 if @failed
|
|
28
33
|
|
|
29
34
|
Datadog.configure do |c|
|
|
@@ -273,8 +273,6 @@ module Datadog
|
|
|
273
273
|
# Signal Remote::Component to configure the library.
|
|
274
274
|
# Note that it will call this component back (unfortunate circular dependency).
|
|
275
275
|
remote.configure(test_session)
|
|
276
|
-
|
|
277
|
-
test_discovery&.on_test_session_start
|
|
278
276
|
end
|
|
279
277
|
|
|
280
278
|
# intentionally empty
|
|
@@ -310,8 +308,6 @@ module Datadog
|
|
|
310
308
|
test_optimisation.start_coverage(test)
|
|
311
309
|
|
|
312
310
|
test_retries.record_test_started(test)
|
|
313
|
-
|
|
314
|
-
test_discovery&.on_test_started(test)
|
|
315
311
|
end
|
|
316
312
|
|
|
317
313
|
def on_test_session_finished(test_session)
|
|
@@ -321,8 +317,6 @@ module Datadog
|
|
|
321
317
|
|
|
322
318
|
Telemetry.event_finished(test_session)
|
|
323
319
|
|
|
324
|
-
test_discovery&.on_test_session_end
|
|
325
|
-
|
|
326
320
|
Utils::FileStorage.cleanup
|
|
327
321
|
end
|
|
328
322
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
4
|
require_relative "file_storage"
|
|
5
|
+
require_relative "test_run"
|
|
5
6
|
require_relative "../ext/dd_test"
|
|
6
7
|
|
|
7
8
|
module Datadog
|
|
@@ -22,7 +23,7 @@ module Datadog
|
|
|
22
23
|
# Load component state
|
|
23
24
|
def load_component_state
|
|
24
25
|
# Check for DDTest cache first
|
|
25
|
-
if
|
|
26
|
+
if TestRun.test_optimization_data_cached?
|
|
26
27
|
Datadog.logger.debug { "DDTest cache found" }
|
|
27
28
|
return true if restore_state_from_datadog_test_runner
|
|
28
29
|
end
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require "etc"
|
|
4
4
|
|
|
5
|
+
require_relative "../ext/dd_test"
|
|
6
|
+
|
|
5
7
|
module Datadog
|
|
6
8
|
module CI
|
|
7
9
|
module Utils
|
|
@@ -42,6 +44,10 @@ module Datadog
|
|
|
42
44
|
|
|
43
45
|
@virtual_cpu_count = ::Etc.nprocessors
|
|
44
46
|
end
|
|
47
|
+
|
|
48
|
+
def self.test_optimization_data_cached?
|
|
49
|
+
Dir.exist?(Ext::DDTest::TESTOPTIMIZATION_CACHE_PATH)
|
|
50
|
+
end
|
|
45
51
|
end
|
|
46
52
|
end
|
|
47
53
|
end
|
data/lib/datadog/ci/version.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Datadog
|
|
|
5
5
|
module VERSION
|
|
6
6
|
MAJOR = 1
|
|
7
7
|
MINOR = 23
|
|
8
|
-
PATCH =
|
|
8
|
+
PATCH = 3
|
|
9
9
|
PRE = nil
|
|
10
10
|
BUILD = nil
|
|
11
11
|
# PRE and BUILD above are modified for dev gems during gem build GHA workflow
|
|
@@ -22,7 +22,7 @@ module Datadog
|
|
|
22
22
|
# To allow testing with the next unreleased version of Ruby, the version check is performed
|
|
23
23
|
# as `< #{MAXIMUM_RUBY_VERSION}`, meaning prereleases of MAXIMUM_RUBY_VERSION are allowed
|
|
24
24
|
# but not stable MAXIMUM_RUBY_VERSION releases.
|
|
25
|
-
MAXIMUM_RUBY_VERSION = "
|
|
25
|
+
MAXIMUM_RUBY_VERSION = "4.0"
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
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.23.
|
|
4
|
+
version: 1.23.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog, Inc.
|
|
@@ -211,6 +211,7 @@ files:
|
|
|
211
211
|
- lib/datadog/ci/git/upload_packfile.rb
|
|
212
212
|
- lib/datadog/ci/git/user.rb
|
|
213
213
|
- lib/datadog/ci/impacted_tests_detection/component.rb
|
|
214
|
+
- lib/datadog/ci/impacted_tests_detection/null_component.rb
|
|
214
215
|
- lib/datadog/ci/logs/component.rb
|
|
215
216
|
- lib/datadog/ci/logs/transport.rb
|
|
216
217
|
- lib/datadog/ci/readonly_test_module.rb
|
|
@@ -218,10 +219,12 @@ files:
|
|
|
218
219
|
- lib/datadog/ci/remote/component.rb
|
|
219
220
|
- lib/datadog/ci/remote/library_settings.rb
|
|
220
221
|
- lib/datadog/ci/remote/library_settings_client.rb
|
|
222
|
+
- lib/datadog/ci/remote/null_component.rb
|
|
221
223
|
- lib/datadog/ci/remote/slow_test_retries.rb
|
|
222
224
|
- lib/datadog/ci/span.rb
|
|
223
225
|
- lib/datadog/ci/test.rb
|
|
224
226
|
- lib/datadog/ci/test_discovery/component.rb
|
|
227
|
+
- lib/datadog/ci/test_discovery/null_component.rb
|
|
225
228
|
- lib/datadog/ci/test_management/component.rb
|
|
226
229
|
- lib/datadog/ci/test_management/null_component.rb
|
|
227
230
|
- lib/datadog/ci/test_management/tests_properties.rb
|
|
@@ -230,6 +233,7 @@ files:
|
|
|
230
233
|
- lib/datadog/ci/test_optimisation/coverage/ddcov.rb
|
|
231
234
|
- lib/datadog/ci/test_optimisation/coverage/event.rb
|
|
232
235
|
- lib/datadog/ci/test_optimisation/coverage/transport.rb
|
|
236
|
+
- lib/datadog/ci/test_optimisation/null_component.rb
|
|
233
237
|
- lib/datadog/ci/test_optimisation/skippable.rb
|
|
234
238
|
- lib/datadog/ci/test_optimisation/skippable_percentage/base.rb
|
|
235
239
|
- lib/datadog/ci/test_optimisation/skippable_percentage/calculator.rb
|
|
@@ -311,7 +315,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
311
315
|
version: 2.7.0
|
|
312
316
|
- - "<"
|
|
313
317
|
- !ruby/object:Gem::Version
|
|
314
|
-
version: '
|
|
318
|
+
version: '4.0'
|
|
315
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
320
|
requirements:
|
|
317
321
|
- - ">="
|