datadog-ci 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -2
- data/ext/datadog_cov/datadog_cov.c +259 -67
- data/lib/datadog/ci/configuration/components.rb +149 -80
- data/lib/datadog/ci/configuration/settings.rb +6 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +13 -9
- data/lib/datadog/ci/contrib/minitest/runnable.rb +5 -1
- data/lib/datadog/ci/contrib/minitest/runner.rb +6 -2
- data/lib/datadog/ci/contrib/minitest/test.rb +7 -3
- data/lib/datadog/ci/contrib/rspec/example.rb +6 -2
- data/lib/datadog/ci/contrib/rspec/example_group.rb +5 -1
- data/lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb +6 -2
- data/lib/datadog/ci/contrib/rspec/runner.rb +6 -2
- data/lib/datadog/ci/ext/environment/providers/appveyor.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/aws_code_pipeline.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/azure.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/bitbucket.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/bitrise.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/buddy.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/buildkite.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/circleci.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/codefresh.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/github_actions.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/gitlab.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/jenkins.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/teamcity.rb +1 -1
- data/lib/datadog/ci/ext/environment/providers/travis.rb +1 -1
- data/lib/datadog/ci/ext/environment.rb +17 -0
- data/lib/datadog/ci/ext/settings.rb +1 -0
- data/lib/datadog/ci/ext/telemetry.rb +120 -0
- data/lib/datadog/ci/git/local_repository.rb +116 -25
- data/lib/datadog/ci/git/search_commits.rb +20 -1
- data/lib/datadog/ci/git/telemetry.rb +37 -0
- data/lib/datadog/ci/git/tree_uploader.rb +7 -0
- data/lib/datadog/ci/git/upload_packfile.rb +22 -1
- data/lib/datadog/ci/span.rb +3 -3
- data/lib/datadog/ci/test.rb +6 -1
- data/lib/datadog/ci/test_module.rb +1 -1
- data/lib/datadog/ci/{itr/runner.rb → test_optimisation/component.rb} +29 -12
- 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 +11 -2
- data/lib/datadog/ci/{itr → test_optimisation}/coverage/writer.rb +1 -1
- data/lib/datadog/ci/{itr → test_optimisation}/skippable.rb +25 -1
- data/lib/datadog/ci/test_optimisation/telemetry.rb +56 -0
- data/lib/datadog/ci/test_session.rb +1 -1
- data/lib/datadog/ci/test_suite.rb +1 -1
- data/lib/datadog/ci/test_visibility/component.rb +282 -0
- data/lib/datadog/ci/test_visibility/{recorder.rb → context.rb} +39 -187
- data/lib/datadog/ci/test_visibility/{null_recorder.rb → null_component.rb} +6 -4
- data/lib/datadog/ci/test_visibility/{context → store}/global.rb +1 -1
- data/lib/datadog/ci/test_visibility/{context → store}/local.rb +1 -1
- data/lib/datadog/ci/test_visibility/telemetry.rb +69 -0
- data/lib/datadog/ci/test_visibility/transport.rb +9 -10
- data/lib/datadog/ci/transport/adapters/net.rb +42 -11
- data/lib/datadog/ci/transport/adapters/net_http_client.rb +17 -0
- data/lib/datadog/ci/transport/adapters/telemetry_webmock_safe_adapter.rb +28 -0
- data/lib/datadog/ci/transport/event_platform_transport.rb +42 -5
- data/lib/datadog/ci/transport/http.rb +49 -21
- data/lib/datadog/ci/transport/remote_settings_api.rb +39 -1
- data/lib/datadog/ci/transport/telemetry.rb +93 -0
- data/lib/datadog/ci/utils/identity.rb +20 -0
- data/lib/datadog/ci/utils/parsing.rb +2 -1
- data/lib/datadog/ci/utils/telemetry.rb +23 -0
- data/lib/datadog/ci/version.rb +1 -1
- data/lib/datadog/ci.rb +45 -15
- metadata +24 -14
@@ -1,18 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "datadog/core/telemetry/ext"
|
4
|
+
|
3
5
|
require_relative "../ext/settings"
|
4
6
|
require_relative "../git/tree_uploader"
|
5
|
-
require_relative "../
|
6
|
-
require_relative "../
|
7
|
-
require_relative "../
|
7
|
+
require_relative "../test_optimisation/component"
|
8
|
+
require_relative "../test_optimisation/coverage/transport"
|
9
|
+
require_relative "../test_optimisation/coverage/writer"
|
10
|
+
require_relative "../test_visibility/component"
|
8
11
|
require_relative "../test_visibility/flush"
|
9
|
-
require_relative "../test_visibility/
|
10
|
-
require_relative "../test_visibility/null_recorder"
|
12
|
+
require_relative "../test_visibility/null_component"
|
11
13
|
require_relative "../test_visibility/serializers/factories/test_level"
|
12
14
|
require_relative "../test_visibility/serializers/factories/test_suite_level"
|
13
15
|
require_relative "../test_visibility/transport"
|
16
|
+
require_relative "../transport/adapters/telemetry_webmock_safe_adapter"
|
14
17
|
require_relative "../transport/api/builder"
|
15
18
|
require_relative "../transport/remote_settings_api"
|
19
|
+
require_relative "../utils/identity"
|
20
|
+
require_relative "../utils/parsing"
|
16
21
|
require_relative "../utils/test_run"
|
17
22
|
require_relative "../worker"
|
18
23
|
|
@@ -21,15 +26,15 @@ module Datadog
|
|
21
26
|
module Configuration
|
22
27
|
# Adds CI behavior to Datadog trace components
|
23
28
|
module Components
|
24
|
-
attr_reader :
|
29
|
+
attr_reader :test_visibility, :test_optimisation
|
25
30
|
|
26
31
|
def initialize(settings)
|
32
|
+
@test_optimisation = nil
|
33
|
+
@test_visibility = TestVisibility::NullComponent.new
|
34
|
+
|
27
35
|
# Activate CI mode if enabled
|
28
36
|
if settings.ci.enabled
|
29
37
|
activate_ci!(settings)
|
30
|
-
else
|
31
|
-
@itr = nil
|
32
|
-
@ci_recorder = TestVisibility::NullRecorder.new
|
33
38
|
end
|
34
39
|
|
35
40
|
super
|
@@ -38,8 +43,8 @@ module Datadog
|
|
38
43
|
def shutdown!(replacement = nil)
|
39
44
|
super
|
40
45
|
|
41
|
-
@
|
42
|
-
@
|
46
|
+
@test_visibility&.shutdown!
|
47
|
+
@test_optimisation&.shutdown!
|
43
48
|
end
|
44
49
|
|
45
50
|
def activate_ci!(settings)
|
@@ -53,22 +58,19 @@ module Datadog
|
|
53
58
|
return
|
54
59
|
end
|
55
60
|
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
# Deactivate remote configuration
|
61
|
-
settings.remote.enabled = false
|
61
|
+
# Builds test visibility API layer in agentless or EvP proxy mode
|
62
|
+
test_visibility_api = build_test_visibility_api(settings)
|
63
|
+
# bail out early if api is misconfigured
|
64
|
+
return unless settings.ci.enabled
|
62
65
|
|
63
|
-
#
|
64
|
-
|
65
|
-
settings.tracing.trace_id_128_bit_generation_enabled = false
|
66
|
+
# Configure datadog gem for test visibility mode
|
67
|
+
configure_telemetry(settings)
|
66
68
|
|
67
|
-
#
|
68
|
-
settings.
|
69
|
+
# Test visibility uses its own remote settings
|
70
|
+
settings.remote.enabled = false
|
69
71
|
|
70
|
-
#
|
71
|
-
settings.
|
72
|
+
# startup logs are useless for test visibility and create noise
|
73
|
+
settings.diagnostics.startup_logs.enabled = false
|
72
74
|
|
73
75
|
# When timecop is present, Time.now is mocked and .now_without_mock_time is added on Time to
|
74
76
|
# get the current time without the mock.
|
@@ -81,76 +83,70 @@ module Datadog
|
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
84
|
-
#
|
85
|
-
settings.diagnostics.startup_logs.enabled = false
|
86
|
+
# Configure Datadog::Tracing module
|
86
87
|
|
87
|
-
#
|
88
|
-
|
89
|
-
|
90
|
-
test_visibility_api = build_test_visibility_api(settings)
|
88
|
+
# No need not use 128-bit trace ids for test visibility,
|
89
|
+
# they are used for OTEL compatibility in Datadog tracer
|
90
|
+
settings.tracing.trace_id_128_bit_generation_enabled = false
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
)
|
92
|
+
# Activate underlying tracing test mode with async worker
|
93
|
+
settings.tracing.test_mode.enabled = true
|
94
|
+
settings.tracing.test_mode.async = true
|
95
|
+
settings.tracing.test_mode.trace_flush = settings.ci.trace_flush || CI::TestVisibility::Flush::Partial.new
|
97
96
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
)
|
104
|
-
writer_options[:shutdown_timeout] = 60
|
105
|
-
writer_options[:buffer_size] = 10_000
|
97
|
+
trace_writer_options = settings.ci.writer_options
|
98
|
+
trace_writer_options[:shutdown_timeout] = 60
|
99
|
+
trace_writer_options[:buffer_size] = 10_000
|
100
|
+
tracing_transport = build_tracing_transport(settings, test_visibility_api)
|
101
|
+
trace_writer_options[:transport] = tracing_transport if tracing_transport
|
106
102
|
|
107
|
-
|
108
|
-
else
|
109
|
-
# only legacy APM protocol is supported, so no test suite level visibility
|
110
|
-
settings.ci.force_test_level_visibility = true
|
103
|
+
settings.tracing.test_mode.writer_options = trace_writer_options
|
111
104
|
|
112
|
-
|
113
|
-
|
114
|
-
end
|
105
|
+
# @type ivar @test_optimisation: Datadog::CI::TestOptimisation::Component
|
106
|
+
@test_optimisation = build_test_optimisation(settings, test_visibility_api)
|
115
107
|
|
116
|
-
|
108
|
+
@test_visibility = TestVisibility::Component.new(
|
109
|
+
test_optimisation: @test_optimisation,
|
110
|
+
test_suite_level_visibility_enabled: !settings.ci.force_test_level_visibility,
|
111
|
+
remote_settings_api: build_remote_settings_client(settings, test_visibility_api),
|
112
|
+
git_tree_upload_worker: build_git_upload_worker(settings, test_visibility_api)
|
113
|
+
)
|
114
|
+
end
|
117
115
|
|
118
|
-
|
116
|
+
def build_test_optimisation(settings, test_visibility_api)
|
117
|
+
if settings.ci.itr_code_coverage_use_single_threaded_mode &&
|
118
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing
|
119
|
+
Datadog.logger.warn(
|
120
|
+
"Intelligent test runner: Single threaded coverage mode is incompatible with allocation tracing. " \
|
121
|
+
"Allocation tracing will be disabled. It means that test impact analysis will not be able to detect " \
|
122
|
+
"instantiations of objects in your code, which is important for ActiveRecord models. " \
|
123
|
+
"Please add your app/model folder to the list of tracked files or disable single threaded coverage mode."
|
124
|
+
)
|
119
125
|
|
120
|
-
|
121
|
-
|
122
|
-
dd_env: settings.env,
|
123
|
-
config_tags: custom_configuration_tags
|
124
|
-
)
|
126
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing = false
|
127
|
+
end
|
125
128
|
|
126
|
-
|
129
|
+
if RUBY_VERSION.start_with?("3.2.") && RUBY_VERSION < "3.2.3" &&
|
130
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing
|
131
|
+
Datadog.logger.warn(
|
132
|
+
"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 " \
|
133
|
+
"disabled. This is due to a VM bug that can lead to crashes (https://bugs.ruby-lang.org/issues/19482). " \
|
134
|
+
"Please update your Ruby version or add your app/model folder to the list of tracked files." \
|
135
|
+
"Set env variable DD_CIVISIBILITY_ITR_TEST_IMPACT_ANALYSIS_USE_ALLOCATION_TRACING to 0 to disable this warning."
|
136
|
+
)
|
137
|
+
settings.ci.itr_test_impact_analysis_use_allocation_tracing = false
|
138
|
+
end
|
139
|
+
|
140
|
+
TestOptimisation::Component.new(
|
127
141
|
api: test_visibility_api,
|
128
142
|
dd_env: settings.env,
|
129
|
-
config_tags:
|
130
|
-
coverage_writer:
|
143
|
+
config_tags: custom_configuration(settings),
|
144
|
+
coverage_writer: build_coverage_writer(settings, test_visibility_api),
|
131
145
|
enabled: settings.ci.enabled && settings.ci.itr_enabled,
|
132
146
|
bundle_location: settings.ci.itr_code_coverage_excluded_bundle_path,
|
133
|
-
use_single_threaded_coverage: settings.ci.itr_code_coverage_use_single_threaded_mode
|
147
|
+
use_single_threaded_coverage: settings.ci.itr_code_coverage_use_single_threaded_mode,
|
148
|
+
use_allocation_tracing: settings.ci.itr_test_impact_analysis_use_allocation_tracing
|
134
149
|
)
|
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
|
151
|
-
)
|
152
|
-
|
153
|
-
@itr = itr
|
154
150
|
end
|
155
151
|
|
156
152
|
def build_test_visibility_api(settings)
|
@@ -179,12 +175,61 @@ module Datadog
|
|
179
175
|
Datadog.logger.debug(
|
180
176
|
"Old agent version detected, no evp_proxy support. Forcing test level visibility mode"
|
181
177
|
)
|
178
|
+
|
179
|
+
# only legacy APM protocol is supported, so no test suite level visibility
|
180
|
+
settings.ci.force_test_level_visibility = true
|
181
|
+
|
182
|
+
# ITR is not supported with APM protocol
|
183
|
+
settings.ci.itr_enabled = false
|
182
184
|
end
|
183
185
|
end
|
184
186
|
|
185
187
|
api
|
186
188
|
end
|
187
189
|
|
190
|
+
def build_tracing_transport(settings, api)
|
191
|
+
return nil if api.nil?
|
192
|
+
|
193
|
+
TestVisibility::Transport.new(
|
194
|
+
api: api,
|
195
|
+
serializers_factory: serializers_factory(settings),
|
196
|
+
dd_env: settings.env
|
197
|
+
)
|
198
|
+
end
|
199
|
+
|
200
|
+
def build_coverage_writer(settings, api)
|
201
|
+
return nil if api.nil?
|
202
|
+
|
203
|
+
TestOptimisation::Coverage::Writer.new(
|
204
|
+
transport: TestOptimisation::Coverage::Transport.new(api: api)
|
205
|
+
)
|
206
|
+
end
|
207
|
+
|
208
|
+
def build_git_upload_worker(settings, api)
|
209
|
+
if settings.ci.git_metadata_upload_enabled
|
210
|
+
git_tree_uploader = Git::TreeUploader.new(api: api)
|
211
|
+
Worker.new do |repository_url|
|
212
|
+
git_tree_uploader.call(repository_url)
|
213
|
+
end
|
214
|
+
else
|
215
|
+
DummyWorker.new
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def build_remote_settings_client(settings, api)
|
220
|
+
Transport::RemoteSettingsApi.new(
|
221
|
+
api: api,
|
222
|
+
dd_env: settings.env,
|
223
|
+
config_tags: custom_configuration(settings)
|
224
|
+
)
|
225
|
+
end
|
226
|
+
|
227
|
+
# fetch custom tags provided by the user in DD_TAGS env var
|
228
|
+
# with prefix test.configuration.
|
229
|
+
def custom_configuration(settings)
|
230
|
+
@custom_configuration ||= Utils::TestRun.custom_configuration(settings.tags)
|
231
|
+
end
|
232
|
+
|
188
233
|
def serializers_factory(settings)
|
189
234
|
if settings.ci.force_test_level_visibility
|
190
235
|
TestVisibility::Serializers::Factories::TestLevel
|
@@ -204,6 +249,30 @@ module Datadog
|
|
204
249
|
end
|
205
250
|
end
|
206
251
|
|
252
|
+
def configure_telemetry(settings)
|
253
|
+
# in development environment Datadog's telemetry is disabled by default
|
254
|
+
# for test visibility we want to enable it by default unless explicitly disabled
|
255
|
+
# NOTE: before agentless mode is released, we only enable telemetry when running with Datadog Agent
|
256
|
+
env_telemetry_enabled = ENV[Core::Telemetry::Ext::ENV_ENABLED]
|
257
|
+
settings.telemetry.enabled = !settings.ci.agentless_mode_enabled &&
|
258
|
+
(env_telemetry_enabled.nil? || Utils::Parsing.convert_to_bool(env_telemetry_enabled))
|
259
|
+
|
260
|
+
return unless settings.telemetry.enabled
|
261
|
+
|
262
|
+
begin
|
263
|
+
require "datadog/core/environment/identity"
|
264
|
+
require "datadog/core/telemetry/http/adapters/net"
|
265
|
+
|
266
|
+
# patch gem's identity to report datadog-ci library version instead of datadog gem version
|
267
|
+
Core::Environment::Identity.include(CI::Utils::Identity)
|
268
|
+
|
269
|
+
# patch gem's telemetry transport layer to use Net::HTTP instead of WebMock's Net::HTTP
|
270
|
+
Core::Telemetry::Http::Adapters::Net.include(CI::Transport::Adapters::TelemetryWebmockSafeAdapter)
|
271
|
+
rescue => e
|
272
|
+
Datadog.logger.warn("Failed to patch Datadog gem's telemetry layer: #{e}")
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
207
276
|
def timecop?
|
208
277
|
Gem.loaded_specs.key?("timecop") || !!defined?(Timecop)
|
209
278
|
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
|
|
@@ -35,14 +35,14 @@ module Datadog
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def on_test_run_started(event)
|
38
|
-
|
38
|
+
test_visibility_component.start_test_session(
|
39
39
|
tags: {
|
40
40
|
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
|
41
41
|
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::Cucumber::Integration.version.to_s
|
42
42
|
},
|
43
43
|
service: configuration[:service_name]
|
44
44
|
)
|
45
|
-
|
45
|
+
test_visibility_component.start_test_module(Ext::FRAMEWORK)
|
46
46
|
end
|
47
47
|
|
48
48
|
def on_test_run_finished(event)
|
@@ -70,7 +70,7 @@ module Datadog
|
|
70
70
|
|
71
71
|
start_test_suite(test_suite_name) unless same_test_suite_as_current?(test_suite_name)
|
72
72
|
|
73
|
-
test_span =
|
73
|
+
test_span = test_visibility_component.trace_test(
|
74
74
|
event.test_case.name,
|
75
75
|
test_suite_name,
|
76
76
|
tags: tags,
|
@@ -82,7 +82,7 @@ module Datadog
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def on_test_case_finished(event)
|
85
|
-
test_span =
|
85
|
+
test_span = test_visibility_component.active_test
|
86
86
|
return if test_span.nil?
|
87
87
|
|
88
88
|
finish_span(test_span, event.result)
|
@@ -90,11 +90,11 @@ module Datadog
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def on_test_step_started(event)
|
93
|
-
|
93
|
+
test_visibility_component.trace(event.test_step.to_s, type: Ext::STEP_SPAN_TYPE)
|
94
94
|
end
|
95
95
|
|
96
96
|
def on_test_step_finished(event)
|
97
|
-
current_step_span =
|
97
|
+
current_step_span = test_visibility_component.active_span
|
98
98
|
return if current_step_span.nil?
|
99
99
|
|
100
100
|
finish_span(current_step_span, event.result)
|
@@ -130,8 +130,8 @@ module Datadog
|
|
130
130
|
def finish_session(result)
|
131
131
|
finish_current_test_suite
|
132
132
|
|
133
|
-
test_session =
|
134
|
-
test_module =
|
133
|
+
test_session = test_visibility_component.active_test_session
|
134
|
+
test_module = test_visibility_component.active_test_module
|
135
135
|
|
136
136
|
return unless test_session && test_module
|
137
137
|
|
@@ -150,7 +150,7 @@ module Datadog
|
|
150
150
|
def start_test_suite(test_suite_name)
|
151
151
|
finish_current_test_suite
|
152
152
|
|
153
|
-
@current_test_suite =
|
153
|
+
@current_test_suite = test_visibility_component.start_test_suite(test_suite_name)
|
154
154
|
end
|
155
155
|
|
156
156
|
def finish_current_test_suite
|
@@ -197,6 +197,10 @@ module Datadog
|
|
197
197
|
def configuration
|
198
198
|
Datadog.configuration.ci[:cucumber]
|
199
199
|
end
|
200
|
+
|
201
|
+
def test_visibility_component
|
202
|
+
Datadog.send(:components).test_visibility
|
203
|
+
end
|
200
204
|
end
|
201
205
|
end
|
202
206
|
end
|
@@ -19,7 +19,7 @@ module Datadog
|
|
19
19
|
|
20
20
|
test_suite_name = Helpers.test_suite_name(self, method)
|
21
21
|
|
22
|
-
test_suite =
|
22
|
+
test_suite = test_visibility_component.start_test_suite(test_suite_name)
|
23
23
|
|
24
24
|
results = super
|
25
25
|
return results unless test_suite
|
@@ -34,6 +34,10 @@ module Datadog
|
|
34
34
|
def datadog_configuration
|
35
35
|
Datadog.configuration.ci[:minitest]
|
36
36
|
end
|
37
|
+
|
38
|
+
def test_visibility_component
|
39
|
+
Datadog.send(:components).test_visibility
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
@@ -18,14 +18,14 @@ module Datadog
|
|
18
18
|
|
19
19
|
return unless datadog_configuration[:enabled]
|
20
20
|
|
21
|
-
|
21
|
+
test_visibility_component.start_test_session(
|
22
22
|
tags: {
|
23
23
|
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
|
24
24
|
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::Minitest::Integration.version.to_s
|
25
25
|
},
|
26
26
|
service: datadog_configuration[:service_name]
|
27
27
|
)
|
28
|
-
|
28
|
+
test_visibility_component.start_test_module(Ext::FRAMEWORK)
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
@@ -33,6 +33,10 @@ module Datadog
|
|
33
33
|
def datadog_configuration
|
34
34
|
Datadog.configuration.ci[:minitest]
|
35
35
|
end
|
36
|
+
|
37
|
+
def test_visibility_component
|
38
|
+
Datadog.send(:components).test_visibility
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
@@ -26,12 +26,12 @@ module Datadog
|
|
26
26
|
test_suite_name = "#{test_suite_name} (#{name} concurrently)"
|
27
27
|
|
28
28
|
# for parallel execution we need to start a new test suite for each test
|
29
|
-
|
29
|
+
test_visibility_component.start_test_suite(test_suite_name)
|
30
30
|
end
|
31
31
|
|
32
32
|
source_file, line_number = method(name).source_location
|
33
33
|
|
34
|
-
test_span =
|
34
|
+
test_span = test_visibility_component.trace_test(
|
35
35
|
name,
|
36
36
|
test_suite_name,
|
37
37
|
tags: {
|
@@ -47,7 +47,7 @@ module Datadog
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def after_teardown
|
50
|
-
test_span =
|
50
|
+
test_span = test_visibility_component.active_test
|
51
51
|
return super unless test_span
|
52
52
|
|
53
53
|
finish_with_result(test_span, result_code)
|
@@ -77,6 +77,10 @@ module Datadog
|
|
77
77
|
def datadog_configuration
|
78
78
|
Datadog.configuration.ci[:minitest]
|
79
79
|
end
|
80
|
+
|
81
|
+
def test_visibility_component
|
82
|
+
Datadog.send(:components).test_visibility
|
83
|
+
end
|
80
84
|
end
|
81
85
|
|
82
86
|
module ClassMethods
|
@@ -34,10 +34,10 @@ module Datadog
|
|
34
34
|
|
35
35
|
if ci_queue?
|
36
36
|
suite_name = "#{suite_name} (ci-queue running example [#{test_name}])"
|
37
|
-
test_suite_span =
|
37
|
+
test_suite_span = test_visibility_component.start_test_suite(suite_name)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
test_visibility_component.trace_test(
|
41
41
|
test_name,
|
42
42
|
suite_name,
|
43
43
|
tags: {
|
@@ -99,6 +99,10 @@ module Datadog
|
|
99
99
|
Datadog.configuration.ci[:rspec]
|
100
100
|
end
|
101
101
|
|
102
|
+
def test_visibility_component
|
103
|
+
Datadog.send(:components).test_visibility
|
104
|
+
end
|
105
|
+
|
102
106
|
def ci_queue?
|
103
107
|
!!defined?(::RSpec::Queue::ExampleExtension) &&
|
104
108
|
self.class.ancestors.include?(::RSpec::Queue::ExampleExtension)
|
@@ -21,7 +21,7 @@ module Datadog
|
|
21
21
|
return super unless top_level?
|
22
22
|
|
23
23
|
suite_name = "#{description} at #{file_path}"
|
24
|
-
test_suite =
|
24
|
+
test_suite = test_visibility_component.start_test_suite(suite_name)
|
25
25
|
|
26
26
|
success = super
|
27
27
|
return success unless test_suite
|
@@ -44,6 +44,10 @@ module Datadog
|
|
44
44
|
def datadog_configuration
|
45
45
|
Datadog.configuration.ci[:rspec]
|
46
46
|
end
|
47
|
+
|
48
|
+
def test_visibility_component
|
49
|
+
Datadog.send(:components).test_visibility
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
@@ -18,7 +18,7 @@ module Datadog
|
|
18
18
|
return super if ::RSpec.configuration.dry_run?
|
19
19
|
return super unless datadog_configuration[:enabled]
|
20
20
|
|
21
|
-
test_session =
|
21
|
+
test_session = test_visibility_component.start_test_session(
|
22
22
|
tags: {
|
23
23
|
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
|
24
24
|
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::RSpec::Integration.version.to_s
|
@@ -26,7 +26,7 @@ module Datadog
|
|
26
26
|
service: datadog_configuration[:service_name]
|
27
27
|
)
|
28
28
|
|
29
|
-
test_module =
|
29
|
+
test_module = test_visibility_component.start_test_module(Ext::FRAMEWORK)
|
30
30
|
|
31
31
|
result = super
|
32
32
|
return result unless test_module && test_session
|
@@ -49,6 +49,10 @@ module Datadog
|
|
49
49
|
def datadog_configuration
|
50
50
|
Datadog.configuration.ci[:rspec]
|
51
51
|
end
|
52
|
+
|
53
|
+
def test_visibility_component
|
54
|
+
Datadog.send(:components).test_visibility
|
55
|
+
end
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
@@ -18,7 +18,7 @@ module Datadog
|
|
18
18
|
return super if ::RSpec.configuration.dry_run?
|
19
19
|
return super unless datadog_configuration[:enabled]
|
20
20
|
|
21
|
-
test_session =
|
21
|
+
test_session = test_visibility_component.start_test_session(
|
22
22
|
tags: {
|
23
23
|
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
|
24
24
|
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::RSpec::Integration.version.to_s
|
@@ -26,7 +26,7 @@ module Datadog
|
|
26
26
|
service: datadog_configuration[:service_name]
|
27
27
|
)
|
28
28
|
|
29
|
-
test_module =
|
29
|
+
test_module = test_visibility_component.start_test_module(Ext::FRAMEWORK)
|
30
30
|
|
31
31
|
result = super
|
32
32
|
return result unless test_module && test_session
|
@@ -49,6 +49,10 @@ module Datadog
|
|
49
49
|
def datadog_configuration
|
50
50
|
Datadog.configuration.ci[:rspec]
|
51
51
|
end
|
52
|
+
|
53
|
+
def test_visibility_component
|
54
|
+
Datadog.send(:components).test_visibility
|
55
|
+
end
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|