datadog-ci 0.5.0 → 0.6.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 +33 -2
- data/lib/datadog/ci/configuration/components.rb +13 -9
- data/lib/datadog/ci/configuration/extensions.rb +21 -0
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +1 -1
- data/lib/datadog/ci/contrib/cucumber/ext.rb +7 -5
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +99 -19
- data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +1 -1
- data/lib/datadog/ci/contrib/minitest/ext.rb +6 -4
- data/lib/datadog/ci/contrib/minitest/helpers.rb +22 -0
- data/lib/datadog/ci/contrib/minitest/hooks.rb +45 -17
- data/lib/datadog/ci/contrib/minitest/patcher.rb +7 -0
- data/lib/datadog/ci/contrib/minitest/plugin.rb +73 -0
- data/lib/datadog/ci/contrib/minitest/runnable.rb +42 -0
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +1 -1
- data/lib/datadog/ci/contrib/rspec/example.rb +2 -2
- data/lib/datadog/ci/contrib/rspec/example_group.rb +46 -0
- data/lib/datadog/ci/contrib/rspec/ext.rb +5 -4
- data/lib/datadog/ci/contrib/rspec/integration.rb +1 -1
- data/lib/datadog/ci/contrib/rspec/patcher.rb +5 -0
- data/lib/datadog/ci/contrib/rspec/runner.rb +57 -0
- data/lib/datadog/ci/contrib/settings.rb +1 -1
- data/lib/datadog/ci/ext/test.rb +2 -0
- data/lib/datadog/ci/span.rb +24 -0
- data/lib/datadog/ci/test.rb +30 -0
- data/lib/datadog/ci/test_session.rb +8 -0
- data/lib/datadog/ci/test_visibility/context/global.rb +82 -0
- data/lib/datadog/ci/test_visibility/context/local.rb +52 -0
- data/lib/datadog/ci/test_visibility/null_recorder.rb +73 -0
- data/lib/datadog/ci/test_visibility/recorder.rb +314 -0
- data/lib/datadog/ci/version.rb +1 -1
- data/lib/datadog/ci.rb +3 -3
- data/sig/datadog/ci/configuration/components.rbs +2 -2
- data/sig/datadog/ci/configuration/extensions.rbs +9 -0
- data/sig/datadog/ci/contrib/cucumber/ext.rbs +1 -5
- data/sig/datadog/ci/contrib/cucumber/formatter.rbs +17 -4
- data/sig/datadog/ci/contrib/minitest/ext.rbs +1 -5
- data/sig/datadog/ci/contrib/minitest/helpers.rbs +13 -0
- data/sig/datadog/ci/contrib/minitest/hooks.rbs +9 -1
- data/sig/datadog/ci/contrib/minitest/plugin.rbs +31 -0
- data/sig/datadog/ci/contrib/minitest/runnable.rbs +24 -0
- data/sig/datadog/ci/contrib/rspec/example_group.rbs +21 -0
- data/sig/datadog/ci/contrib/rspec/ext.rbs +2 -8
- data/sig/datadog/ci/contrib/rspec/runner.rbs +21 -0
- data/sig/datadog/ci/ext/test.rbs +2 -0
- data/sig/datadog/ci/span.rbs +8 -0
- data/sig/datadog/ci/test.rbs +5 -0
- data/sig/datadog/ci/test_visibility/context/global.rbs +39 -0
- data/sig/datadog/ci/test_visibility/context/local.rbs +23 -0
- data/sig/datadog/ci/test_visibility/null_recorder.rbs +45 -0
- data/sig/datadog/ci/test_visibility/recorder.rbs +85 -0
- data/sig/datadog/ci.rbs +3 -1
- metadata +23 -11
- data/lib/datadog/ci/context/global.rb +0 -80
- data/lib/datadog/ci/context/local.rb +0 -50
- data/lib/datadog/ci/extensions.rb +0 -19
- data/lib/datadog/ci/recorder.rb +0 -291
- data/sig/datadog/ci/context/global.rbs +0 -37
- data/sig/datadog/ci/context/local.rbs +0 -21
- data/sig/datadog/ci/extensions.rbs +0 -7
- data/sig/datadog/ci/recorder.rbs +0 -83
@@ -0,0 +1,23 @@
|
|
1
|
+
module Datadog
|
2
|
+
module CI
|
3
|
+
module TestVisibility
|
4
|
+
module Context
|
5
|
+
class Local
|
6
|
+
@key: Symbol
|
7
|
+
|
8
|
+
def initialize: () -> void
|
9
|
+
|
10
|
+
def activate_test!: (Datadog::CI::Test test) ?{ () -> untyped } -> void
|
11
|
+
|
12
|
+
def deactivate_test!: (Datadog::CI::Test test) -> void
|
13
|
+
|
14
|
+
def active_test: () -> Datadog::CI::Test?
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def active_test=: (Datadog::CI::Test? test) -> untyped
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Datadog
|
2
|
+
module CI
|
3
|
+
module TestVisibility
|
4
|
+
class NullRecorder
|
5
|
+
@null_span: Datadog::CI::NullSpan
|
6
|
+
|
7
|
+
def initialize: (?untyped args) -> void
|
8
|
+
|
9
|
+
def trace_test: (String span_name, String test_suite_name, ?service: String?, ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Span span) -> untyped } -> untyped
|
10
|
+
|
11
|
+
def trace: (String span_type, String span_name, ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Span span) -> untyped } -> untyped
|
12
|
+
|
13
|
+
def start_test_session: (?service: String?, ?tags: Hash[untyped, untyped]) -> Datadog::CI::Span
|
14
|
+
|
15
|
+
def start_test_module: (String test_module_name, ?service: String?, ?tags: Hash[untyped, untyped]) -> Datadog::CI::Span
|
16
|
+
|
17
|
+
def start_test_suite: (String test_suite_name, ?service: String?, ?tags: Hash[untyped, untyped]) -> Datadog::CI::Span
|
18
|
+
|
19
|
+
def active_test_session: () -> Datadog::CI::TestSession?
|
20
|
+
|
21
|
+
def active_test_module: () -> Datadog::CI::TestModule?
|
22
|
+
|
23
|
+
def active_test_suite: (String test_suite_name) -> Datadog::CI::TestSuite?
|
24
|
+
|
25
|
+
def active_test: () -> Datadog::CI::Test?
|
26
|
+
|
27
|
+
def active_span: () -> Datadog::CI::Span?
|
28
|
+
|
29
|
+
def deactivate_test: (Datadog::CI::Test test) -> void
|
30
|
+
|
31
|
+
def deactivate_test_session: () -> void
|
32
|
+
|
33
|
+
def deactivate_test_module: () -> void
|
34
|
+
|
35
|
+
def deactivate_test_suite: (String test_suite_name) -> void
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def null_span: () -> Datadog::CI::Span
|
40
|
+
|
41
|
+
def skip_tracing: (?untyped block) -> untyped
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Datadog
|
2
|
+
module CI
|
3
|
+
module TestVisibility
|
4
|
+
class Recorder
|
5
|
+
@test_suite_level_visibility_enabled: bool
|
6
|
+
|
7
|
+
@environment_tags: Hash[String, String]
|
8
|
+
@local_context: Datadog::CI::TestVisibility::Context::Local
|
9
|
+
@global_context: Datadog::CI::TestVisibility::Context::Global
|
10
|
+
|
11
|
+
@null_span: Datadog::CI::NullSpan
|
12
|
+
|
13
|
+
attr_reader environment_tags: Hash[String, String]
|
14
|
+
attr_reader test_suite_level_visibility_enabled: bool
|
15
|
+
|
16
|
+
def initialize: (?test_suite_level_visibility_enabled: bool) -> void
|
17
|
+
|
18
|
+
def trace_test: (String span_name, String test_suite_name, ?service: String?, ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Span span) -> untyped } -> untyped
|
19
|
+
|
20
|
+
def trace: (String span_type, String span_name, ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Span span) -> untyped } -> untyped
|
21
|
+
|
22
|
+
def start_test_session: (?service: String?, ?tags: Hash[untyped, untyped]) -> Datadog::CI::Span
|
23
|
+
|
24
|
+
def start_test_module: (String test_module_name, ?service: String?, ?tags: Hash[untyped, untyped]) -> Datadog::CI::Span
|
25
|
+
|
26
|
+
def start_test_suite: (String test_suite_name, ?service: String?, ?tags: Hash[untyped, untyped]) -> Datadog::CI::Span
|
27
|
+
|
28
|
+
def active_test_session: () -> Datadog::CI::TestSession?
|
29
|
+
|
30
|
+
def active_test_module: () -> Datadog::CI::TestModule?
|
31
|
+
|
32
|
+
def active_test_suite: (String test_suite_name) -> Datadog::CI::TestSuite?
|
33
|
+
|
34
|
+
def active_test: () -> Datadog::CI::Test?
|
35
|
+
|
36
|
+
def active_span: () -> Datadog::CI::Span?
|
37
|
+
|
38
|
+
def deactivate_test: (Datadog::CI::Test test) -> void
|
39
|
+
|
40
|
+
def deactivate_test_session: () -> void
|
41
|
+
|
42
|
+
def deactivate_test_module: () -> void
|
43
|
+
|
44
|
+
def deactivate_test_suite: (String test_suite_name) -> void
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def create_datadog_span: (String span_name, ?span_options: Hash[untyped, untyped], ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Span span) -> untyped } -> untyped
|
49
|
+
|
50
|
+
def set_trace_origin: (Datadog::Tracing::TraceOperation trace) -> untyped
|
51
|
+
|
52
|
+
def build_test: (Datadog::Tracing::SpanOperation tracer_span, Hash[untyped, untyped] tags) -> Datadog::CI::Test
|
53
|
+
|
54
|
+
def build_test_session: (Datadog::Tracing::SpanOperation tracer_span, Hash[untyped, untyped] tags) -> Datadog::CI::TestSession
|
55
|
+
|
56
|
+
def build_test_module: (Datadog::Tracing::SpanOperation tracer_span, Hash[untyped, untyped] tags) -> Datadog::CI::TestModule
|
57
|
+
|
58
|
+
def build_test_suite: (Datadog::Tracing::SpanOperation tracer_span, Hash[untyped, untyped] tags) -> Datadog::CI::TestSuite
|
59
|
+
|
60
|
+
def build_span: (Datadog::Tracing::SpanOperation tracer_span, Hash[untyped, untyped] tags) -> Datadog::CI::Span
|
61
|
+
|
62
|
+
def build_span_options: (String? service_name, String span_type, ?Hash[Symbol, untyped] other_options) -> Hash[Symbol, untyped]
|
63
|
+
|
64
|
+
def set_initial_tags: (Datadog::CI::Span ci_span, Hash[untyped, untyped] tags) -> void
|
65
|
+
|
66
|
+
# the type (Datadog::CI::TestSession | Datadog::Tracing::SpanOperation) screams of wrong/mising abstraction
|
67
|
+
def set_session_context: (Hash[untyped, untyped] tags, ?Datadog::CI::TestSession | Datadog::Tracing::SpanOperation? test_session) -> void
|
68
|
+
|
69
|
+
def set_suite_context: (Hash[untyped, untyped] tags, ?span: Datadog::Tracing::SpanOperation, ?name: String) -> void
|
70
|
+
|
71
|
+
def set_module_context: (Hash[untyped, untyped] tags, ?Datadog::CI::TestModule | Datadog::Tracing::SpanOperation? test_module) -> void
|
72
|
+
|
73
|
+
def null_span: () -> Datadog::CI::Span
|
74
|
+
|
75
|
+
def skip_tracing: (?untyped block) -> untyped
|
76
|
+
|
77
|
+
def start_datadog_tracer_span: (String span_name, Hash[untyped, untyped] span_options) ?{ (untyped) -> untyped } -> untyped
|
78
|
+
|
79
|
+
def set_inherited_globals: (Hash[untyped, untyped] tags) -> void
|
80
|
+
|
81
|
+
def validate_test_suite_level_visibility_correctness: (Datadog::CI::Test test) -> void
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/sig/datadog/ci.rbs
CHANGED
@@ -18,6 +18,8 @@ module Datadog
|
|
18
18
|
|
19
19
|
def self.active_test: () -> Datadog::CI::Test?
|
20
20
|
|
21
|
+
def self.active_test_suite: (String test_suite_name) -> Datadog::CI::TestSuite?
|
22
|
+
|
21
23
|
def self.active_span: (String span_type) -> Datadog::CI::Span?
|
22
24
|
|
23
25
|
def self.deactivate_test: (Datadog::CI::Test test) -> void
|
@@ -30,6 +32,6 @@ module Datadog
|
|
30
32
|
|
31
33
|
def self.components: () -> Datadog::CI::Configuration::Components
|
32
34
|
|
33
|
-
def self.recorder: () -> Datadog::CI::Recorder
|
35
|
+
def self.recorder: () -> Datadog::CI::TestVisibility::Recorder
|
34
36
|
end
|
35
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datadog-ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -44,9 +44,8 @@ files:
|
|
44
44
|
- lib/datadog/ci.rb
|
45
45
|
- lib/datadog/ci/concurrent_span.rb
|
46
46
|
- lib/datadog/ci/configuration/components.rb
|
47
|
+
- lib/datadog/ci/configuration/extensions.rb
|
47
48
|
- lib/datadog/ci/configuration/settings.rb
|
48
|
-
- lib/datadog/ci/context/global.rb
|
49
|
-
- lib/datadog/ci/context/local.rb
|
50
49
|
- lib/datadog/ci/contrib/cucumber/configuration/settings.rb
|
51
50
|
- lib/datadog/ci/contrib/cucumber/ext.rb
|
52
51
|
- lib/datadog/ci/contrib/cucumber/formatter.rb
|
@@ -56,14 +55,19 @@ files:
|
|
56
55
|
- lib/datadog/ci/contrib/integration.rb
|
57
56
|
- lib/datadog/ci/contrib/minitest/configuration/settings.rb
|
58
57
|
- lib/datadog/ci/contrib/minitest/ext.rb
|
58
|
+
- lib/datadog/ci/contrib/minitest/helpers.rb
|
59
59
|
- lib/datadog/ci/contrib/minitest/hooks.rb
|
60
60
|
- lib/datadog/ci/contrib/minitest/integration.rb
|
61
61
|
- lib/datadog/ci/contrib/minitest/patcher.rb
|
62
|
+
- lib/datadog/ci/contrib/minitest/plugin.rb
|
63
|
+
- lib/datadog/ci/contrib/minitest/runnable.rb
|
62
64
|
- lib/datadog/ci/contrib/rspec/configuration/settings.rb
|
63
65
|
- lib/datadog/ci/contrib/rspec/example.rb
|
66
|
+
- lib/datadog/ci/contrib/rspec/example_group.rb
|
64
67
|
- lib/datadog/ci/contrib/rspec/ext.rb
|
65
68
|
- lib/datadog/ci/contrib/rspec/integration.rb
|
66
69
|
- lib/datadog/ci/contrib/rspec/patcher.rb
|
70
|
+
- lib/datadog/ci/contrib/rspec/runner.rb
|
67
71
|
- lib/datadog/ci/contrib/settings.rb
|
68
72
|
- lib/datadog/ci/ext/app_types.rb
|
69
73
|
- lib/datadog/ci/ext/environment.rb
|
@@ -90,15 +94,17 @@ files:
|
|
90
94
|
- lib/datadog/ci/ext/settings.rb
|
91
95
|
- lib/datadog/ci/ext/test.rb
|
92
96
|
- lib/datadog/ci/ext/transport.rb
|
93
|
-
- lib/datadog/ci/extensions.rb
|
94
97
|
- lib/datadog/ci/null_span.rb
|
95
|
-
- lib/datadog/ci/recorder.rb
|
96
98
|
- lib/datadog/ci/span.rb
|
97
99
|
- lib/datadog/ci/test.rb
|
98
100
|
- lib/datadog/ci/test_module.rb
|
99
101
|
- lib/datadog/ci/test_session.rb
|
100
102
|
- lib/datadog/ci/test_suite.rb
|
103
|
+
- lib/datadog/ci/test_visibility/context/global.rb
|
104
|
+
- lib/datadog/ci/test_visibility/context/local.rb
|
101
105
|
- lib/datadog/ci/test_visibility/flush.rb
|
106
|
+
- lib/datadog/ci/test_visibility/null_recorder.rb
|
107
|
+
- lib/datadog/ci/test_visibility/recorder.rb
|
102
108
|
- lib/datadog/ci/test_visibility/serializers/base.rb
|
103
109
|
- lib/datadog/ci/test_visibility/serializers/factories/test_level.rb
|
104
110
|
- lib/datadog/ci/test_visibility/serializers/factories/test_suite_level.rb
|
@@ -122,9 +128,8 @@ files:
|
|
122
128
|
- sig/datadog/ci.rbs
|
123
129
|
- sig/datadog/ci/concurrent_span.rbs
|
124
130
|
- sig/datadog/ci/configuration/components.rbs
|
131
|
+
- sig/datadog/ci/configuration/extensions.rbs
|
125
132
|
- sig/datadog/ci/configuration/settings.rbs
|
126
|
-
- sig/datadog/ci/context/global.rbs
|
127
|
-
- sig/datadog/ci/context/local.rbs
|
128
133
|
- sig/datadog/ci/contrib/cucumber/configuration/settings.rbs
|
129
134
|
- sig/datadog/ci/contrib/cucumber/ext.rbs
|
130
135
|
- sig/datadog/ci/contrib/cucumber/formatter.rbs
|
@@ -134,14 +139,19 @@ files:
|
|
134
139
|
- sig/datadog/ci/contrib/integration.rbs
|
135
140
|
- sig/datadog/ci/contrib/minitest/configuration/settings.rbs
|
136
141
|
- sig/datadog/ci/contrib/minitest/ext.rbs
|
142
|
+
- sig/datadog/ci/contrib/minitest/helpers.rbs
|
137
143
|
- sig/datadog/ci/contrib/minitest/hooks.rbs
|
138
144
|
- sig/datadog/ci/contrib/minitest/integration.rbs
|
139
145
|
- sig/datadog/ci/contrib/minitest/patcher.rbs
|
146
|
+
- sig/datadog/ci/contrib/minitest/plugin.rbs
|
147
|
+
- sig/datadog/ci/contrib/minitest/runnable.rbs
|
140
148
|
- sig/datadog/ci/contrib/rspec/configuration/settings.rbs
|
141
149
|
- sig/datadog/ci/contrib/rspec/example.rbs
|
150
|
+
- sig/datadog/ci/contrib/rspec/example_group.rbs
|
142
151
|
- sig/datadog/ci/contrib/rspec/ext.rbs
|
143
152
|
- sig/datadog/ci/contrib/rspec/integration.rbs
|
144
153
|
- sig/datadog/ci/contrib/rspec/patcher.rbs
|
154
|
+
- sig/datadog/ci/contrib/rspec/runner.rbs
|
145
155
|
- sig/datadog/ci/contrib/settings.rbs
|
146
156
|
- sig/datadog/ci/ext/app_types.rbs
|
147
157
|
- sig/datadog/ci/ext/environment.rbs
|
@@ -168,15 +178,17 @@ files:
|
|
168
178
|
- sig/datadog/ci/ext/settings.rbs
|
169
179
|
- sig/datadog/ci/ext/test.rbs
|
170
180
|
- sig/datadog/ci/ext/transport.rbs
|
171
|
-
- sig/datadog/ci/extensions.rbs
|
172
181
|
- sig/datadog/ci/null_span.rbs
|
173
|
-
- sig/datadog/ci/recorder.rbs
|
174
182
|
- sig/datadog/ci/span.rbs
|
175
183
|
- sig/datadog/ci/test.rbs
|
176
184
|
- sig/datadog/ci/test_module.rbs
|
177
185
|
- sig/datadog/ci/test_session.rbs
|
178
186
|
- sig/datadog/ci/test_suite.rbs
|
187
|
+
- sig/datadog/ci/test_visibility/context/global.rbs
|
188
|
+
- sig/datadog/ci/test_visibility/context/local.rbs
|
179
189
|
- sig/datadog/ci/test_visibility/flush.rbs
|
190
|
+
- sig/datadog/ci/test_visibility/null_recorder.rbs
|
191
|
+
- sig/datadog/ci/test_visibility/recorder.rbs
|
180
192
|
- sig/datadog/ci/test_visibility/serializers/base.rbs
|
181
193
|
- sig/datadog/ci/test_visibility/serializers/factories/test_level.rbs
|
182
194
|
- sig/datadog/ci/test_visibility/serializers/factories/test_suite_level.rbs
|
@@ -223,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
235
|
- !ruby/object:Gem::Version
|
224
236
|
version: 2.0.0
|
225
237
|
requirements: []
|
226
|
-
rubygems_version: 3.4.
|
238
|
+
rubygems_version: 3.4.22
|
227
239
|
signing_key:
|
228
240
|
specification_version: 4
|
229
241
|
summary: Datadog CI visibility for your ruby application
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module CI
|
5
|
-
module Context
|
6
|
-
# This context is shared between threads and represents the current test session and test module.
|
7
|
-
class Global
|
8
|
-
def initialize
|
9
|
-
# we are using Monitor instead of Mutex because it is reentrant
|
10
|
-
@mutex = Monitor.new
|
11
|
-
|
12
|
-
@test_session = nil
|
13
|
-
@test_module = nil
|
14
|
-
@test_suites = {}
|
15
|
-
end
|
16
|
-
|
17
|
-
def fetch_or_activate_test_suite(test_suite_name, &block)
|
18
|
-
@mutex.synchronize do
|
19
|
-
@test_suites[test_suite_name] ||= block.call
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def fetch_or_activate_test_module(&block)
|
24
|
-
@mutex.synchronize do
|
25
|
-
@test_module ||= block.call
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def fetch_or_activate_test_session(&block)
|
30
|
-
@mutex.synchronize do
|
31
|
-
@test_session ||= block.call
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def active_test_module
|
36
|
-
@test_module
|
37
|
-
end
|
38
|
-
|
39
|
-
def active_test_session
|
40
|
-
@test_session
|
41
|
-
end
|
42
|
-
|
43
|
-
def active_test_suite(test_suite_name)
|
44
|
-
@mutex.synchronize { @test_suites[test_suite_name] }
|
45
|
-
end
|
46
|
-
|
47
|
-
def service
|
48
|
-
@mutex.synchronize do
|
49
|
-
# thank you RBS for this weirdness
|
50
|
-
test_session = @test_session
|
51
|
-
test_session.service if test_session
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def inheritable_session_tags
|
56
|
-
@mutex.synchronize do
|
57
|
-
test_session = @test_session
|
58
|
-
if test_session
|
59
|
-
test_session.inheritable_tags
|
60
|
-
else
|
61
|
-
{}
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def deactivate_test_session!
|
67
|
-
@mutex.synchronize { @test_session = nil }
|
68
|
-
end
|
69
|
-
|
70
|
-
def deactivate_test_module!
|
71
|
-
@mutex.synchronize { @test_module = nil }
|
72
|
-
end
|
73
|
-
|
74
|
-
def deactivate_test_suite!(test_suite_name)
|
75
|
-
@mutex.synchronize { @test_suites.delete(test_suite_name) }
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module CI
|
5
|
-
module Context
|
6
|
-
class Local
|
7
|
-
def initialize
|
8
|
-
@key = :datadog_ci_active_test
|
9
|
-
|
10
|
-
self.active_test = nil
|
11
|
-
end
|
12
|
-
|
13
|
-
def activate_test!(test)
|
14
|
-
raise "Nested tests are not supported. Currently active test: #{active_test}" unless active_test.nil?
|
15
|
-
|
16
|
-
if block_given?
|
17
|
-
begin
|
18
|
-
self.active_test = test
|
19
|
-
yield
|
20
|
-
ensure
|
21
|
-
self.active_test = nil
|
22
|
-
end
|
23
|
-
else
|
24
|
-
self.active_test = test
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def deactivate_test!(test)
|
29
|
-
return if active_test.nil?
|
30
|
-
|
31
|
-
if active_test == test
|
32
|
-
self.active_test = nil
|
33
|
-
else
|
34
|
-
raise "Trying to deactivate test #{test}, but currently active test is #{active_test}"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def active_test
|
39
|
-
Thread.current[@key]
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def active_test=(test)
|
45
|
-
Thread.current[@key] = test
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "datadog/core/configuration/settings"
|
4
|
-
require "datadog/core/configuration/components"
|
5
|
-
|
6
|
-
require_relative "configuration/settings"
|
7
|
-
require_relative "configuration/components"
|
8
|
-
|
9
|
-
module Datadog
|
10
|
-
module CI
|
11
|
-
# Extends Datadog tracing with CI features
|
12
|
-
module Extensions
|
13
|
-
def self.activate!
|
14
|
-
Core::Configuration::Settings.extend(CI::Configuration::Settings)
|
15
|
-
Core::Configuration::Components.prepend(CI::Configuration::Components)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|