datadog-ci 1.0.1 → 1.2.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 +16 -2
- data/ext/datadog_cov/datadog_cov.c +259 -67
- data/lib/datadog/ci/configuration/components.rb +121 -79
- data/lib/datadog/ci/configuration/settings.rb +6 -0
- data/lib/datadog/ci/contrib/rspec/example.rb +1 -1
- data/lib/datadog/ci/contrib/rspec/patcher.rb +3 -3
- data/lib/datadog/ci/ext/settings.rb +1 -0
- data/lib/datadog/ci/span.rb +3 -3
- data/lib/datadog/ci/test.rb +1 -1
- data/lib/datadog/ci/test_module.rb +1 -1
- data/lib/datadog/ci/{itr/runner.rb → test_optimisation/component.rb} +13 -10
- data/lib/datadog/ci/{itr → test_optimisation}/coverage/ddcov.rb +1 -1
- data/lib/datadog/ci/{itr → test_optimisation}/coverage/event.rb +1 -1
- data/lib/datadog/ci/{itr → test_optimisation}/coverage/transport.rb +1 -1
- data/lib/datadog/ci/{itr → test_optimisation}/coverage/writer.rb +1 -1
- data/lib/datadog/ci/{itr → test_optimisation}/skippable.rb +1 -1
- data/lib/datadog/ci/test_session.rb +1 -1
- data/lib/datadog/ci/test_suite.rb +1 -1
- data/lib/datadog/ci/test_visibility/{recorder.rb → component.rb} +10 -10
- data/lib/datadog/ci/test_visibility/{null_recorder.rb → null_component.rb} +6 -4
- data/lib/datadog/ci/test_visibility/transport.rb +1 -1
- data/lib/datadog/ci/transport/adapters/net.rb +138 -0
- data/lib/datadog/ci/transport/api/agentless.rb +2 -2
- data/lib/datadog/ci/transport/api/evp_proxy.rb +1 -1
- data/lib/datadog/ci/transport/http.rb +7 -57
- data/lib/datadog/ci/version.rb +2 -2
- data/lib/datadog/ci.rb +15 -15
- metadata +12 -11
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
require_relative "../ext/settings"
|
4
4
|
require_relative "../git/tree_uploader"
|
5
|
-
require_relative "../
|
6
|
-
require_relative "../
|
7
|
-
require_relative "../
|
5
|
+
require_relative "../test_optimisation/component"
|
6
|
+
require_relative "../test_optimisation/coverage/transport"
|
7
|
+
require_relative "../test_optimisation/coverage/writer"
|
8
|
+
require_relative "../test_visibility/component"
|
8
9
|
require_relative "../test_visibility/flush"
|
9
|
-
require_relative "../test_visibility/
|
10
|
-
require_relative "../test_visibility/null_recorder"
|
10
|
+
require_relative "../test_visibility/null_component"
|
11
11
|
require_relative "../test_visibility/serializers/factories/test_level"
|
12
12
|
require_relative "../test_visibility/serializers/factories/test_suite_level"
|
13
13
|
require_relative "../test_visibility/transport"
|
@@ -21,15 +21,15 @@ module Datadog
|
|
21
21
|
module Configuration
|
22
22
|
# Adds CI behavior to Datadog trace components
|
23
23
|
module Components
|
24
|
-
attr_reader :
|
24
|
+
attr_reader :test_visibility, :test_optimisation
|
25
25
|
|
26
26
|
def initialize(settings)
|
27
|
+
@test_optimisation = nil
|
28
|
+
@test_visibility = TestVisibility::NullComponent.new
|
29
|
+
|
27
30
|
# Activate CI mode if enabled
|
28
31
|
if settings.ci.enabled
|
29
32
|
activate_ci!(settings)
|
30
|
-
else
|
31
|
-
@itr = nil
|
32
|
-
@ci_recorder = TestVisibility::NullRecorder.new
|
33
33
|
end
|
34
34
|
|
35
35
|
super
|
@@ -38,8 +38,8 @@ module Datadog
|
|
38
38
|
def shutdown!(replacement = nil)
|
39
39
|
super
|
40
40
|
|
41
|
-
@
|
42
|
-
@
|
41
|
+
@test_visibility&.shutdown!
|
42
|
+
@test_optimisation&.shutdown!
|
43
43
|
end
|
44
44
|
|
45
45
|
def activate_ci!(settings)
|
@@ -53,22 +53,21 @@ module Datadog
|
|
53
53
|
return
|
54
54
|
end
|
55
55
|
|
56
|
-
#
|
56
|
+
# Builds test visibility API layer in agentless or EvP proxy mode
|
57
|
+
test_visibility_api = build_test_visibility_api(settings)
|
58
|
+
# bail out early if api is misconfigured
|
59
|
+
return unless settings.ci.enabled
|
60
|
+
|
61
|
+
# Configure datadog gem for test visibility mode
|
62
|
+
|
57
63
|
# Deactivate telemetry
|
58
64
|
settings.telemetry.enabled = false
|
59
65
|
|
60
|
-
#
|
66
|
+
# Test visibility uses its own remote settings
|
61
67
|
settings.remote.enabled = false
|
62
68
|
|
63
|
-
#
|
64
|
-
|
65
|
-
settings.tracing.trace_id_128_bit_generation_enabled = false
|
66
|
-
|
67
|
-
# Activate underlying tracing test mode
|
68
|
-
settings.tracing.test_mode.enabled = true
|
69
|
-
|
70
|
-
# Choose user defined TraceFlush or default to CI TraceFlush
|
71
|
-
settings.tracing.test_mode.trace_flush = settings.ci.trace_flush || CI::TestVisibility::Flush::Partial.new
|
69
|
+
# startup logs are useless for test visibility and create noise
|
70
|
+
settings.diagnostics.startup_logs.enabled = false
|
72
71
|
|
73
72
|
# When timecop is present, Time.now is mocked and .now_without_mock_time is added on Time to
|
74
73
|
# get the current time without the mock.
|
@@ -81,76 +80,70 @@ module Datadog
|
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
84
|
-
#
|
85
|
-
settings.diagnostics.startup_logs.enabled = false
|
83
|
+
# Configure Datadog::Tracing module
|
86
84
|
|
87
|
-
#
|
88
|
-
|
89
|
-
|
90
|
-
test_visibility_api = build_test_visibility_api(settings)
|
85
|
+
# No need not use 128-bit trace ids for test visibility,
|
86
|
+
# they are used for OTEL compatibility in Datadog tracer
|
87
|
+
settings.tracing.trace_id_128_bit_generation_enabled = false
|
91
88
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
)
|
89
|
+
# Activate underlying tracing test mode with async worker
|
90
|
+
settings.tracing.test_mode.enabled = true
|
91
|
+
settings.tracing.test_mode.async = true
|
92
|
+
settings.tracing.test_mode.trace_flush = settings.ci.trace_flush || CI::TestVisibility::Flush::Partial.new
|
97
93
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
)
|
104
|
-
writer_options[:shutdown_timeout] = 60
|
105
|
-
writer_options[:buffer_size] = 10_000
|
94
|
+
trace_writer_options = settings.ci.writer_options
|
95
|
+
trace_writer_options[:shutdown_timeout] = 60
|
96
|
+
trace_writer_options[:buffer_size] = 10_000
|
97
|
+
tracing_transport = build_tracing_transport(settings, test_visibility_api)
|
98
|
+
trace_writer_options[:transport] = tracing_transport if tracing_transport
|
106
99
|
|
107
|
-
|
108
|
-
else
|
109
|
-
# only legacy APM protocol is supported, so no test suite level visibility
|
110
|
-
settings.ci.force_test_level_visibility = true
|
100
|
+
settings.tracing.test_mode.writer_options = trace_writer_options
|
111
101
|
|
112
|
-
|
113
|
-
|
114
|
-
end
|
102
|
+
# @type ivar @test_optimisation: Datadog::CI::TestOptimisation::Component
|
103
|
+
@test_optimisation = build_test_optimisation(settings, test_visibility_api)
|
115
104
|
|
116
|
-
|
105
|
+
@test_visibility = TestVisibility::Component.new(
|
106
|
+
test_optimisation: @test_optimisation,
|
107
|
+
test_suite_level_visibility_enabled: !settings.ci.force_test_level_visibility,
|
108
|
+
remote_settings_api: build_remote_settings_client(settings, test_visibility_api),
|
109
|
+
git_tree_upload_worker: build_git_upload_worker(settings, test_visibility_api)
|
110
|
+
)
|
111
|
+
end
|
117
112
|
|
118
|
-
|
113
|
+
def build_test_optimisation(settings, test_visibility_api)
|
114
|
+
if settings.ci.itr_code_coverage_use_single_threaded_mode &&
|
115
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing
|
116
|
+
Datadog.logger.warn(
|
117
|
+
"Intelligent test runner: Single threaded coverage mode is incompatible with allocation tracing. " \
|
118
|
+
"Allocation tracing will be disabled. It means that test impact analysis will not be able to detect " \
|
119
|
+
"instantiations of objects in your code, which is important for ActiveRecord models. " \
|
120
|
+
"Please add your app/model folder to the list of tracked files or disable single threaded coverage mode."
|
121
|
+
)
|
119
122
|
|
120
|
-
|
121
|
-
|
122
|
-
dd_env: settings.env,
|
123
|
-
config_tags: custom_configuration_tags
|
124
|
-
)
|
123
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing = false
|
124
|
+
end
|
125
125
|
|
126
|
-
|
126
|
+
if RUBY_VERSION.start_with?("3.2.") && RUBY_VERSION < "3.2.3" &&
|
127
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing
|
128
|
+
Datadog.logger.warn(
|
129
|
+
"Intelligent test runner: Allocation tracing is not supported in Ruby versions 3.2.0, 3.2.1 and 3.2.2 and will be forcibly " \
|
130
|
+
"disabled. This is due to a VM bug that can lead to crashes (https://bugs.ruby-lang.org/issues/19482). " \
|
131
|
+
"Please update your Ruby version or add your app/model folder to the list of tracked files." \
|
132
|
+
"Set env variable DD_CIVISIBILITY_ITR_TEST_IMPACT_ANALYSIS_USE_ALLOCATION_TRACING to 0 to disable this warning."
|
133
|
+
)
|
134
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing = false
|
135
|
+
end
|
136
|
+
|
137
|
+
TestOptimisation::Component.new(
|
127
138
|
api: test_visibility_api,
|
128
139
|
dd_env: settings.env,
|
129
|
-
config_tags:
|
130
|
-
coverage_writer:
|
140
|
+
config_tags: custom_configuration(settings),
|
141
|
+
coverage_writer: build_coverage_writer(settings, test_visibility_api),
|
131
142
|
enabled: settings.ci.enabled && settings.ci.itr_enabled,
|
132
143
|
bundle_location: settings.ci.itr_code_coverage_excluded_bundle_path,
|
133
|
-
use_single_threaded_coverage: settings.ci.itr_code_coverage_use_single_threaded_mode
|
134
|
-
|
135
|
-
|
136
|
-
git_tree_uploader = Git::TreeUploader.new(api: test_visibility_api)
|
137
|
-
git_tree_upload_worker = if settings.ci.git_metadata_upload_enabled
|
138
|
-
Worker.new do |repository_url|
|
139
|
-
git_tree_uploader.call(repository_url)
|
140
|
-
end
|
141
|
-
else
|
142
|
-
DummyWorker.new
|
143
|
-
end
|
144
|
-
|
145
|
-
# CI visibility recorder global instance
|
146
|
-
@ci_recorder = TestVisibility::Recorder.new(
|
147
|
-
test_suite_level_visibility_enabled: !settings.ci.force_test_level_visibility,
|
148
|
-
itr: itr,
|
149
|
-
remote_settings_api: remote_settings_api,
|
150
|
-
git_tree_upload_worker: git_tree_upload_worker
|
144
|
+
use_single_threaded_coverage: settings.ci.itr_code_coverage_use_single_threaded_mode,
|
145
|
+
use_allocation_tracing: settings.ci.itr_test_impact_analysis_use_allocation_tracing
|
151
146
|
)
|
152
|
-
|
153
|
-
@itr = itr
|
154
147
|
end
|
155
148
|
|
156
149
|
def build_test_visibility_api(settings)
|
@@ -179,12 +172,61 @@ module Datadog
|
|
179
172
|
Datadog.logger.debug(
|
180
173
|
"Old agent version detected, no evp_proxy support. Forcing test level visibility mode"
|
181
174
|
)
|
175
|
+
|
176
|
+
# only legacy APM protocol is supported, so no test suite level visibility
|
177
|
+
settings.ci.force_test_level_visibility = true
|
178
|
+
|
179
|
+
# ITR is not supported with APM protocol
|
180
|
+
settings.ci.itr_enabled = false
|
182
181
|
end
|
183
182
|
end
|
184
183
|
|
185
184
|
api
|
186
185
|
end
|
187
186
|
|
187
|
+
def build_tracing_transport(settings, api)
|
188
|
+
return nil if api.nil?
|
189
|
+
|
190
|
+
TestVisibility::Transport.new(
|
191
|
+
api: api,
|
192
|
+
serializers_factory: serializers_factory(settings),
|
193
|
+
dd_env: settings.env
|
194
|
+
)
|
195
|
+
end
|
196
|
+
|
197
|
+
def build_coverage_writer(settings, api)
|
198
|
+
return nil if api.nil?
|
199
|
+
|
200
|
+
TestOptimisation::Coverage::Writer.new(
|
201
|
+
transport: TestOptimisation::Coverage::Transport.new(api: api)
|
202
|
+
)
|
203
|
+
end
|
204
|
+
|
205
|
+
def build_git_upload_worker(settings, api)
|
206
|
+
if settings.ci.git_metadata_upload_enabled
|
207
|
+
git_tree_uploader = Git::TreeUploader.new(api: api)
|
208
|
+
Worker.new do |repository_url|
|
209
|
+
git_tree_uploader.call(repository_url)
|
210
|
+
end
|
211
|
+
else
|
212
|
+
DummyWorker.new
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def build_remote_settings_client(settings, api)
|
217
|
+
Transport::RemoteSettingsApi.new(
|
218
|
+
api: api,
|
219
|
+
dd_env: settings.env,
|
220
|
+
config_tags: custom_configuration(settings)
|
221
|
+
)
|
222
|
+
end
|
223
|
+
|
224
|
+
# fetch custom tags provided by the user in DD_TAGS env var
|
225
|
+
# with prefix test.configuration.
|
226
|
+
def custom_configuration(settings)
|
227
|
+
@custom_configuration ||= Utils::TestRun.custom_configuration(settings.tags)
|
228
|
+
end
|
229
|
+
|
188
230
|
def serializers_factory(settings)
|
189
231
|
if settings.ci.force_test_level_visibility
|
190
232
|
TestVisibility::Serializers::Factories::TestLevel
|
@@ -205,7 +247,7 @@ module Datadog
|
|
205
247
|
end
|
206
248
|
|
207
249
|
def timecop?
|
208
|
-
Gem.loaded_specs.key?("timecop") || defined?(Timecop)
|
250
|
+
Gem.loaded_specs.key?("timecop") || !!defined?(Timecop)
|
209
251
|
end
|
210
252
|
end
|
211
253
|
end
|
@@ -82,6 +82,12 @@ module Datadog
|
|
82
82
|
o.default false
|
83
83
|
end
|
84
84
|
|
85
|
+
option :itr_test_impact_analysis_use_allocation_tracing do |o|
|
86
|
+
o.type :bool
|
87
|
+
o.env CI::Ext::Settings::ENV_ITR_TEST_IMPACT_ANALYSIS_USE_ALLOCATION_TRACING
|
88
|
+
o.default true
|
89
|
+
end
|
90
|
+
|
85
91
|
define_method(:instrument) do |integration_name, options = {}, &block|
|
86
92
|
return unless enabled
|
87
93
|
|
@@ -42,15 +42,15 @@ module Datadog
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def ci_queue?
|
45
|
-
defined?(::RSpec::Queue::Runner)
|
45
|
+
!!defined?(::RSpec::Queue::Runner)
|
46
46
|
end
|
47
47
|
|
48
48
|
def knapsack_pro?
|
49
49
|
knapsack_version = Gem.loaded_specs["knapsack_pro"]&.version
|
50
50
|
|
51
51
|
# additional instrumentation is needed for KnapsackPro version 7 and later
|
52
|
-
defined?(::KnapsackPro) &&
|
53
|
-
knapsack_version && knapsack_version >= Gem::Version.new("7")
|
52
|
+
!!defined?(::KnapsackPro) &&
|
53
|
+
!knapsack_version.nil? && knapsack_version >= Gem::Version.new("7")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -14,6 +14,7 @@ module Datadog
|
|
14
14
|
ENV_GIT_METADATA_UPLOAD_ENABLED = "DD_CIVISIBILITY_GIT_METADATA_UPLOAD_ENABLED"
|
15
15
|
ENV_ITR_CODE_COVERAGE_EXCLUDED_BUNDLE_PATH = "DD_CIVISIBILITY_ITR_CODE_COVERAGE_EXCLUDED_BUNDLE_PATH"
|
16
16
|
ENV_ITR_CODE_COVERAGE_USE_SINGLE_THREADED_MODE = "DD_CIVISIBILITY_ITR_CODE_COVERAGE_USE_SINGLE_THREADED_MODE"
|
17
|
+
ENV_ITR_TEST_IMPACT_ANALYSIS_USE_ALLOCATION_TRACING = "DD_CIVISIBILITY_ITR_TEST_IMPACT_ANALYSIS_USE_ALLOCATION_TRACING"
|
17
18
|
|
18
19
|
# Source: https://docs.datadoghq.com/getting_started/site/
|
19
20
|
DD_SITE_ALLOWLIST = %w[
|
data/lib/datadog/ci/span.rb
CHANGED
@@ -202,9 +202,9 @@ module Datadog
|
|
202
202
|
|
203
203
|
private
|
204
204
|
|
205
|
-
# provides access to
|
206
|
-
def
|
207
|
-
Datadog.send(:components).
|
205
|
+
# provides access to the test visibility component for CI models to deactivate themselves
|
206
|
+
def test_visibility
|
207
|
+
Datadog.send(:components).test_visibility
|
208
208
|
end
|
209
209
|
end
|
210
210
|
end
|
data/lib/datadog/ci/test.rb
CHANGED
@@ -16,11 +16,11 @@ require_relative "skippable"
|
|
16
16
|
|
17
17
|
module Datadog
|
18
18
|
module CI
|
19
|
-
module
|
19
|
+
module TestOptimisation
|
20
20
|
# Intelligent test runner implementation
|
21
21
|
# Integrates with backend to provide test impact analysis data and
|
22
22
|
# skip tests that are not impacted by the changes
|
23
|
-
class
|
23
|
+
class Component
|
24
24
|
include Core::Utils::Forking
|
25
25
|
|
26
26
|
attr_reader :correlation_id, :skippable_tests, :skipped_tests_count
|
@@ -32,7 +32,8 @@ module Datadog
|
|
32
32
|
coverage_writer: nil,
|
33
33
|
enabled: false,
|
34
34
|
bundle_location: nil,
|
35
|
-
use_single_threaded_coverage: false
|
35
|
+
use_single_threaded_coverage: false,
|
36
|
+
use_allocation_tracing: true
|
36
37
|
)
|
37
38
|
@enabled = enabled
|
38
39
|
@api = api
|
@@ -45,6 +46,7 @@ module Datadog
|
|
45
46
|
bundle_location
|
46
47
|
end
|
47
48
|
@use_single_threaded_coverage = use_single_threaded_coverage
|
49
|
+
@use_allocation_tracing = use_allocation_tracing
|
48
50
|
|
49
51
|
@test_skipping_enabled = false
|
50
52
|
@code_coverage_enabled = false
|
@@ -57,11 +59,11 @@ module Datadog
|
|
57
59
|
@skipped_tests_count = 0
|
58
60
|
@mutex = Mutex.new
|
59
61
|
|
60
|
-
Datadog.logger.debug("
|
62
|
+
Datadog.logger.debug("TestOptimisation initialized with enabled: #{@enabled}")
|
61
63
|
end
|
62
64
|
|
63
65
|
def configure(remote_configuration, test_session:, git_tree_upload_worker:)
|
64
|
-
Datadog.logger.debug("Configuring
|
66
|
+
Datadog.logger.debug("Configuring TestOptimisation with remote configuration: #{remote_configuration}")
|
65
67
|
|
66
68
|
@enabled = Utils::Parsing.convert_to_bool(
|
67
69
|
remote_configuration.fetch(Ext::Transport::DD_API_SETTINGS_RESPONSE_ITR_ENABLED_KEY, false)
|
@@ -83,7 +85,7 @@ module Datadog
|
|
83
85
|
|
84
86
|
load_datadog_cov! if @code_coverage_enabled
|
85
87
|
|
86
|
-
Datadog.logger.debug("Configured
|
88
|
+
Datadog.logger.debug("Configured TestOptimisation with enabled: #{@enabled}, skipping_tests: #{@test_skipping_enabled}, code_coverage: #{@code_coverage_enabled}")
|
87
89
|
|
88
90
|
fetch_skippable_tests(test_session: test_session, git_tree_upload_worker: git_tree_upload_worker)
|
89
91
|
end
|
@@ -139,7 +141,7 @@ module Datadog
|
|
139
141
|
skippable_test_id = Utils::TestRun.skippable_test_id(test.name, test.test_suite_name, test.parameters)
|
140
142
|
if @skippable_tests.include?(skippable_test_id)
|
141
143
|
if forked?
|
142
|
-
Datadog.logger.warn { "
|
144
|
+
Datadog.logger.warn { "Intelligent test runner is not supported for forking test runners yet" }
|
143
145
|
return
|
144
146
|
end
|
145
147
|
|
@@ -155,7 +157,7 @@ module Datadog
|
|
155
157
|
return if !test.skipped? || !test.skipped_by_itr?
|
156
158
|
|
157
159
|
if forked?
|
158
|
-
Datadog.logger.warn { "
|
160
|
+
Datadog.logger.warn { "Intelligent test runner is not supported for forking test runners yet" }
|
159
161
|
return
|
160
162
|
end
|
161
163
|
|
@@ -167,7 +169,7 @@ module Datadog
|
|
167
169
|
def write_test_session_tags(test_session)
|
168
170
|
return if !enabled?
|
169
171
|
|
170
|
-
Datadog.logger.debug { "Finished
|
172
|
+
Datadog.logger.debug { "Finished optimised session with test skipping enabled: #{@test_skipping_enabled}" }
|
171
173
|
Datadog.logger.debug { "#{@skipped_tests_count} tests were skipped" }
|
172
174
|
|
173
175
|
test_session.set_tag(Ext::Test::TAG_ITR_TESTS_SKIPPED, @skipped_tests_count.positive?.to_s)
|
@@ -189,7 +191,8 @@ module Datadog
|
|
189
191
|
Thread.current[:dd_coverage_collector] ||= Coverage::DDCov.new(
|
190
192
|
root: Git::LocalRepository.root,
|
191
193
|
ignored_path: @bundle_location,
|
192
|
-
threading_mode: code_coverage_mode
|
194
|
+
threading_mode: code_coverage_mode,
|
195
|
+
use_allocation_tracing: @use_allocation_tracing
|
193
196
|
)
|
194
197
|
end
|
195
198
|
|
@@ -28,11 +28,11 @@ module Datadog
|
|
28
28
|
module TestVisibility
|
29
29
|
# Common behavior for CI tests
|
30
30
|
# Note: this class has too many responsibilities and should be split into multiple classes
|
31
|
-
class
|
31
|
+
class Component
|
32
32
|
attr_reader :environment_tags, :test_suite_level_visibility_enabled
|
33
33
|
|
34
34
|
def initialize(
|
35
|
-
|
35
|
+
test_optimisation:,
|
36
36
|
remote_settings_api:,
|
37
37
|
git_tree_upload_worker: DummyWorker.new,
|
38
38
|
test_suite_level_visibility_enabled: false,
|
@@ -46,7 +46,7 @@ module Datadog
|
|
46
46
|
|
47
47
|
@codeowners = codeowners
|
48
48
|
|
49
|
-
@
|
49
|
+
@test_optimisation = test_optimisation
|
50
50
|
@remote_settings_api = remote_settings_api
|
51
51
|
@git_tree_upload_worker = git_tree_upload_worker
|
52
52
|
end
|
@@ -210,7 +210,7 @@ module Datadog
|
|
210
210
|
end
|
211
211
|
|
212
212
|
def itr_enabled?
|
213
|
-
@
|
213
|
+
@test_optimisation.enabled?
|
214
214
|
end
|
215
215
|
|
216
216
|
private
|
@@ -234,7 +234,7 @@ module Datadog
|
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
|
-
@
|
237
|
+
@test_optimisation.configure(
|
238
238
|
remote_configuration.payload,
|
239
239
|
test_session: test_session,
|
240
240
|
git_tree_upload_worker: @git_tree_upload_worker
|
@@ -404,17 +404,17 @@ module Datadog
|
|
404
404
|
|
405
405
|
# TODO: use kind of event system to notify about test finished?
|
406
406
|
def on_test_finished(test)
|
407
|
-
@
|
408
|
-
@
|
407
|
+
@test_optimisation.stop_coverage(test)
|
408
|
+
@test_optimisation.count_skipped_test(test)
|
409
409
|
end
|
410
410
|
|
411
411
|
def on_test_started(test)
|
412
|
-
@
|
413
|
-
@
|
412
|
+
@test_optimisation.mark_if_skippable(test)
|
413
|
+
@test_optimisation.start_coverage(test)
|
414
414
|
end
|
415
415
|
|
416
416
|
def on_test_session_finished(test_session)
|
417
|
-
@
|
417
|
+
@test_optimisation.write_test_session_tags(test_session)
|
418
418
|
end
|
419
419
|
end
|
420
420
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "recorder"
|
4
|
-
|
5
3
|
module Datadog
|
6
4
|
module CI
|
7
5
|
module TestVisibility
|
8
|
-
# Special
|
9
|
-
class
|
6
|
+
# Special test visibility component that does not record anything
|
7
|
+
class NullComponent
|
10
8
|
def start_test_session(service: nil, tags: {})
|
11
9
|
skip_tracing
|
12
10
|
end
|
@@ -45,6 +43,10 @@ module Datadog
|
|
45
43
|
def shutdown!
|
46
44
|
end
|
47
45
|
|
46
|
+
def itr_enabled?
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
48
50
|
private
|
49
51
|
|
50
52
|
def skip_tracing(block = nil)
|