datadog-ci 0.4.1 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -1
  3. data/README.md +26 -3
  4. data/lib/datadog/ci/concurrent_span.rb +59 -0
  5. data/lib/datadog/ci/configuration/components.rb +34 -4
  6. data/lib/datadog/ci/configuration/extensions.rb +21 -0
  7. data/lib/datadog/ci/configuration/settings.rb +7 -1
  8. data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +12 -1
  9. data/lib/datadog/ci/contrib/cucumber/formatter.rb +3 -4
  10. data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +10 -1
  11. data/lib/datadog/ci/contrib/minitest/hooks.rb +3 -4
  12. data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +10 -1
  13. data/lib/datadog/ci/contrib/rspec/example.rb +3 -4
  14. data/lib/datadog/ci/contrib/settings.rb +2 -0
  15. data/lib/datadog/ci/ext/app_types.rb +5 -0
  16. data/lib/datadog/ci/ext/settings.rb +11 -0
  17. data/lib/datadog/ci/ext/test.rb +12 -1
  18. data/lib/datadog/ci/null_span.rb +63 -0
  19. data/lib/datadog/ci/span.rb +13 -3
  20. data/lib/datadog/ci/test.rb +0 -1
  21. data/lib/datadog/ci/test_module.rb +23 -0
  22. data/lib/datadog/ci/test_session.rb +36 -0
  23. data/lib/datadog/ci/test_suite.rb +25 -0
  24. data/lib/datadog/ci/test_visibility/context/global.rb +82 -0
  25. data/lib/datadog/ci/test_visibility/context/local.rb +52 -0
  26. data/lib/datadog/ci/test_visibility/recorder.rb +293 -0
  27. data/lib/datadog/ci/test_visibility/serializers/base.rb +100 -12
  28. data/lib/datadog/ci/test_visibility/serializers/factories/test_suite_level.rb +37 -0
  29. data/lib/datadog/ci/test_visibility/serializers/span.rb +2 -16
  30. data/lib/datadog/ci/test_visibility/serializers/test_module.rb +46 -0
  31. data/lib/datadog/ci/test_visibility/serializers/test_session.rb +46 -0
  32. data/lib/datadog/ci/test_visibility/serializers/test_suite.rb +46 -0
  33. data/lib/datadog/ci/test_visibility/serializers/test_v1.rb +3 -17
  34. data/lib/datadog/ci/test_visibility/serializers/test_v2.rb +38 -0
  35. data/lib/datadog/ci/test_visibility/transport.rb +4 -4
  36. data/lib/datadog/ci/utils/test_run.rb +15 -0
  37. data/lib/datadog/ci/version.rb +1 -1
  38. data/lib/datadog/ci.rb +217 -35
  39. data/sig/datadog/ci/concurrent_span.rbs +23 -0
  40. data/sig/datadog/ci/configuration/components.rbs +4 -2
  41. data/sig/datadog/ci/configuration/extensions.rbs +9 -0
  42. data/sig/datadog/ci/ext/app_types.rbs +6 -1
  43. data/sig/datadog/ci/ext/settings.rbs +3 -0
  44. data/sig/datadog/ci/ext/test.rbs +15 -0
  45. data/sig/datadog/ci/null_span.rbs +37 -0
  46. data/sig/datadog/ci/span.rbs +4 -0
  47. data/sig/datadog/ci/test_module.rbs +6 -0
  48. data/sig/datadog/ci/test_session.rbs +9 -0
  49. data/sig/datadog/ci/test_suite.rbs +6 -0
  50. data/sig/datadog/ci/test_visibility/context/global.rbs +39 -0
  51. data/sig/datadog/ci/test_visibility/context/local.rbs +23 -0
  52. data/sig/datadog/ci/test_visibility/recorder.rbs +85 -0
  53. data/sig/datadog/ci/test_visibility/serializers/base.rbs +26 -5
  54. data/sig/datadog/ci/test_visibility/serializers/factories/test_suite_level.rbs +13 -0
  55. data/sig/datadog/ci/test_visibility/serializers/test_module.rbs +26 -0
  56. data/sig/datadog/ci/test_visibility/serializers/test_session.rbs +26 -0
  57. data/sig/datadog/ci/test_visibility/serializers/test_suite.rbs +26 -0
  58. data/sig/datadog/ci/test_visibility/serializers/test_v1.rbs +1 -1
  59. data/sig/datadog/ci/test_visibility/serializers/test_v2.rbs +25 -0
  60. data/sig/datadog/ci/test_visibility/transport.rbs +3 -3
  61. data/sig/datadog/ci/utils/test_run.rbs +11 -0
  62. data/sig/datadog/ci.rbs +19 -3
  63. metadata +32 -8
  64. data/lib/datadog/ci/context/local.rb +0 -50
  65. data/lib/datadog/ci/extensions.rb +0 -19
  66. data/lib/datadog/ci/recorder.rb +0 -119
  67. data/sig/datadog/ci/context/local.rbs +0 -21
  68. data/sig/datadog/ci/extensions.rbs +0 -7
  69. data/sig/datadog/ci/recorder.rbs +0 -30
data/lib/datadog/ci.rb CHANGED
@@ -10,16 +10,180 @@ module Datadog
10
10
  # @public_api
11
11
  module CI
12
12
  class << self
13
+ # Starts a {Datadog::CI::TestSession ci_test_session} that represents the whole test session run.
14
+ #
15
+ # Read Datadog documentation on test sessions
16
+ # [here](https://docs.datadoghq.com/continuous_integration/explorer/?tab=testruns#sessions).
17
+ #
18
+ # Returns the existing test session if one is already active. There is at most a single test session per process.
19
+ #
20
+ # The {.start_test_session} method is used to mark the start of the test session:
21
+ # ```
22
+ # Datadog::CI.start_test_session(
23
+ # service: "my-web-site-tests",
24
+ # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
25
+ # )
26
+ #
27
+ # # Somewhere else after test run has ended
28
+ # Datadog::CI.active_test_session.finish
29
+ # ```
30
+ #
31
+ # Remember that calling {Datadog::CI::TestSession#finish} is mandatory.
32
+ #
33
+ # @param [String] service the service name for this session (optional, defaults to DD_SERVICE)
34
+ # @param [Hash<String,String>] tags extra tags which should be added to the test session.
35
+ # @return [Datadog::CI::TestSession] returns the active, running {Datadog::CI::TestSession}.
36
+ # @return [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled or if old Datadog agent is
37
+ # detected and test suite level visibility cannot be supported.
38
+ def start_test_session(service: nil, tags: {})
39
+ service ||= Datadog.configuration.service
40
+ recorder.start_test_session(service: service, tags: tags)
41
+ end
42
+
43
+ # The active, unfinished test session.
44
+ #
45
+ # Usage:
46
+ #
47
+ # ```
48
+ # # start a test session
49
+ # Datadog::CI.start_test_session(
50
+ # service: "my-web-site-tests",
51
+ # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
52
+ # )
53
+ #
54
+ # # somewhere else, access the session
55
+ # test_session = Datadog::CI.active_test_session
56
+ # test_session.finish
57
+ # ```
58
+ #
59
+ # @return [Datadog::CI::TestSession] the active test session
60
+ # @return [nil] if no test session is active
61
+ def active_test_session
62
+ recorder.active_test_session
63
+ end
64
+
65
+ # Starts a {Datadog::CI::TestModule ci_test_module} that represents a single test module (for most Ruby test frameworks
66
+ # module will correspond 1-1 to the test session).
67
+ #
68
+ # Read Datadog documentation on test modules
69
+ # [here](https://docs.datadoghq.com/continuous_integration/explorer/?tab=testruns#module).
70
+ #
71
+ # Returns the existing test session if one is already active. There is at most a single test module per process
72
+ # active at any given time.
73
+ #
74
+ # The {.start_test_module} method is used to mark the start of the test session:
75
+ # ```
76
+ # Datadog::CI.start_test_module(
77
+ # "my-module",
78
+ # service: "my-web-site-tests",
79
+ # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
80
+ # )
81
+ #
82
+ # # Somewhere else after the module has ended
83
+ # Datadog::CI.active_test_module.finish
84
+ # ```
85
+ #
86
+ # Remember that calling {Datadog::CI::TestModule#finish} is mandatory.
87
+ #
88
+ # @param [String] test_module_name the name for this module
89
+ # @param [String] service the service name for this session (optional, inherited from test session if not provided)
90
+ # @param [Hash<String,String>] tags extra tags which should be added to the test module (optional, some tags are inherited from test session).
91
+ # @return [Datadog::CI::TestModule] returns the active, running {Datadog::CI::TestModule}.
92
+ # @return [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled or if old Datadog agent is
93
+ # detected and test suite level visibility cannot be supported.
94
+ def start_test_module(test_module_name, service: nil, tags: {})
95
+ recorder.start_test_module(test_module_name, service: service, tags: tags)
96
+ end
97
+
98
+ # The active, unfinished test module.
99
+ #
100
+ # Usage:
101
+ #
102
+ # ```
103
+ # # start a test module
104
+ # Datadog::CI.start_test_module(
105
+ # "my-module",
106
+ # service: "my-web-site-tests",
107
+ # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
108
+ # )
109
+ #
110
+ # # somewhere else, access the current module
111
+ # test_module = Datadog::CI.active_test_module
112
+ # test_module.finish
113
+ # ```
114
+ #
115
+ # @return [Datadog::CI::TestModule] the active test module
116
+ # @return [nil] if no test module is active
117
+ def active_test_module
118
+ recorder.active_test_module
119
+ end
120
+
121
+ # Starts a {Datadog::CI::TestSuite ci_test_suite} that represents a single test suite.
122
+ # If a test suite with given name is running, returns the existing test suite.
123
+ #
124
+ # Read Datadog documentation on test suites
125
+ # [here](https://docs.datadoghq.com/continuous_integration/explorer/?tab=testruns#module).
126
+ #
127
+ # The {.start_test_suite} method is used to mark the start of a test suite:
128
+ # ```
129
+ # Datadog::CI.start_test_suite(
130
+ # "calculator_tests",
131
+ # service: "my-web-site-tests",
132
+ # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
133
+ # )
134
+ #
135
+ # # Somewhere else after the suite has ended
136
+ # Datadog::CI.active_test_suite("calculator_tests").finish
137
+ # ```
138
+ #
139
+ # Remember that calling {Datadog::CI::TestSuite#finish} is mandatory.
140
+ #
141
+ # @param [String] test_suite_name the name of the test suite
142
+ # @param [String] service the service name for this test suite (optional, inherited from test session if not provided)
143
+ # @param [Hash<String,String>] tags extra tags which should be added to the test module (optional, some tags are inherited from test session)
144
+ # @return [Datadog::CI::TestSuite] returns the active, running {Datadog::CI::TestSuite}.
145
+ # @return [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled or if old Datadog agent is
146
+ # detected and test suite level visibility cannot be supported.
147
+ def start_test_suite(test_suite_name, service: nil, tags: {})
148
+ recorder.start_test_suite(test_suite_name, service: service, tags: tags)
149
+ end
150
+
151
+ # The active, unfinished test suite.
152
+ #
153
+ # Usage:
154
+ #
155
+ # ```
156
+ # # start a test suite
157
+ # Datadog::CI.start_test_suite(
158
+ # "calculator_tests",
159
+ # service: "my-web-site-tests",
160
+ # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
161
+ # )
162
+ #
163
+ # # Somewhere else after the suite has ended
164
+ # test_suite = Datadog::CI.active_test_suite("calculator_tests")
165
+ # test_suite.finish
166
+ # ```
167
+ #
168
+ # @return [Datadog::CI::TestSuite] the active test suite
169
+ # @return [nil] if no test suite with given name is active
170
+ def active_test_suite(test_suite_name)
171
+ recorder.active_test_suite(test_suite_name)
172
+ end
173
+
13
174
  # Return a {Datadog::CI::Test ci_test} that will trace a test called `test_name`.
14
175
  # Raises an error if a test is already active.
176
+ # If there is an active test session, the new test will be connected to the session.
177
+ # The test will inherit service name and tags from the running test session if not provided
178
+ # in parameters.
15
179
  #
16
180
  # You could trace your test using a <tt>do-block</tt> like:
17
181
  #
18
182
  # ```
19
183
  # Datadog::CI.trace_test(
20
184
  # "test_add_two_numbers",
21
- # service_name: "my-web-site-tests",
22
- # operation_name: "test",
185
+ # "calculator_tests",
186
+ # service: "my-web-site-tests",
23
187
  # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
24
188
  # ) do |ci_test|
25
189
  # result = run_test
@@ -32,60 +196,59 @@ module Datadog
32
196
  # end
33
197
  # ```
34
198
  #
35
- # The {#trace_test} method can also be used without a block in this way:
199
+ # The {.trace_test} method can also be used without a block in this way:
36
200
  # ```
37
201
  # ci_test = Datadog::CI.trace_test(
38
- # "test_add_two_numbers',
202
+ # "test_add_two_numbers",
203
+ # "calculator_tests",
39
204
  # service: "my-web-site-tests",
40
- # operation_name: "test",
41
205
  # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
42
206
  # )
43
- # run_test
207
+ # # ... run test here ...
44
208
  # ci_test.finish
45
209
  # ```
46
210
  #
47
211
  # Remember that in this case, calling {Datadog::CI::Test#finish} is mandatory.
48
212
  #
49
213
  # @param [String] test_name {Datadog::CI::Test} name (example: "test_add_two_numbers").
50
- # @param [String] operation_name defines label for a test span in trace view ("test" if it's missing)
51
- # @param [String] service_name the service name for this test
214
+ # @param [String] test_suite_name name of test suite this test belongs to (example: "CalculatorTest").
215
+ # @param [String] service the service name for this test (optional, inherited from test session if not provided)
52
216
  # @param [Hash<String,String>] tags extra tags which should be added to the test.
53
217
  # @return [Object] If a block is provided, returns the result of the block execution.
54
218
  # @return [Datadog::CI::Test] If no block is provided, returns the active,
55
219
  # unfinished {Datadog::CI::Test}.
56
- # @yield Optional block where new newly created {Datadog::CI::Test} captures the execution.
220
+ # @return [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled
221
+ # @yield Optional block where newly created {Datadog::CI::Test} captures the execution.
57
222
  # @yieldparam [Datadog::CI::Test] ci_test the newly created and active [Datadog::CI::Test]
58
- #
59
- # @public_api
60
- def trace_test(test_name, service_name: nil, operation_name: "test", tags: {}, &block)
61
- recorder.trace_test(test_name, service_name: service_name, operation_name: operation_name, tags: tags, &block)
223
+ # @yieldparam [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled
224
+ def trace_test(test_name, test_suite_name, service: nil, tags: {}, &block)
225
+ recorder.trace_test(test_name, test_suite_name, service: service, tags: tags, &block)
62
226
  end
63
227
 
64
- # Same as {#trace_test} but it does not accept a block.
228
+ # Same as {.trace_test} but it does not accept a block.
65
229
  # Raises an error if a test is already active.
66
230
  #
67
231
  # Usage:
68
232
  #
69
233
  # ```
70
234
  # ci_test = Datadog::CI.start_test(
71
- # "test_add_two_numbers',
235
+ # "test_add_two_numbers",
236
+ # "calculator_tests",
72
237
  # service: "my-web-site-tests",
73
- # operation_name: "test",
74
238
  # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
75
239
  # )
76
- # run_test
240
+ # # ... run test here ...
77
241
  # ci_test.finish
78
242
  # ```
79
243
  #
80
244
  # @param [String] test_name {Datadog::CI::Test} name (example: "test_add_two_numbers").
81
- # @param [String] operation_name the resource this span refers, or `test` if it's missing
82
- # @param [String] service_name the service name for this span.
245
+ # @param [String] test_suite_name name of test suite this test belongs to (example: "CalculatorTest").
246
+ # @param [String] service the service name for this span (optional, inherited from test session if not provided)
83
247
  # @param [Hash<String,String>] tags extra tags which should be added to the test.
84
248
  # @return [Datadog::CI::Test] Returns the active, unfinished {Datadog::CI::Test}.
85
- #
86
- # @public_api
87
- def start_test(test_name, service_name: nil, operation_name: "test", tags: {})
88
- recorder.trace_test(test_name, service_name: service_name, operation_name: operation_name, tags: tags)
249
+ # @return [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled
250
+ def start_test(test_name, test_suite_name, service: nil, tags: {})
251
+ recorder.trace_test(test_name, test_suite_name, service: service, tags: tags)
89
252
  end
90
253
 
91
254
  # Trace any custom span inside a test. For example, you could trace:
@@ -93,7 +256,7 @@ module Datadog
93
256
  # - database query
94
257
  # - any custom operation you want to see in your trace view
95
258
  #
96
- # You can use thi method with a <tt>do-block</tt> like:
259
+ # You can use this method with a <tt>do-block</tt> like:
97
260
  #
98
261
  # ```
99
262
  # Datadog::CI.trace(
@@ -105,14 +268,14 @@ module Datadog
105
268
  # end
106
269
  # ```
107
270
  #
108
- # The {#trace} method can also be used without a block in this way:
271
+ # The {.trace} method can also be used without a block in this way:
109
272
  # ```
110
273
  # ci_span = Datadog::CI.trace(
111
274
  # "step",
112
275
  # "Given I have 42 cucumbers",
113
276
  # tags: {}
114
277
  # )
115
- # run_test
278
+ # # ... run test here ...
116
279
  # ci_span.finish
117
280
  # ```
118
281
  # Remember that in this case, calling {Datadog::CI::Span#finish} is mandatory.
@@ -123,10 +286,10 @@ module Datadog
123
286
  # @return [Object] If a block is provided, returns the result of the block execution.
124
287
  # @return [Datadog::CI::Span] If no block is provided, returns the active,
125
288
  # unfinished {Datadog::CI::Span}.
126
- # @yield Optional block where new newly created {Datadog::CI::Span} captures the execution.
289
+ # @return [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled
290
+ # @yield Optional block where newly created {Datadog::CI::Span} captures the execution.
127
291
  # @yieldparam [Datadog::CI::Span] ci_span the newly created and active [Datadog::CI::Span]
128
- #
129
- # @public_api
292
+ # @yieldparam [Datadog::CI::NullSpan] ci_span null object if CI visibility is disabled
130
293
  def trace(span_type, span_name, tags: {}, &block)
131
294
  recorder.trace(span_type, span_name, tags: tags, &block)
132
295
  end
@@ -166,9 +329,9 @@ module Datadog
166
329
  # ```
167
330
  # # start a test
168
331
  # Datadog::CI.start_test(
169
- # "test_add_two_numbers',
332
+ # "test_add_two_numbers",
333
+ # "calculator_tests",
170
334
  # service: "my-web-site-tests",
171
- # operation_name: "test",
172
335
  # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
173
336
  # )
174
337
  #
@@ -184,11 +347,30 @@ module Datadog
184
347
  recorder.active_test
185
348
  end
186
349
 
187
- # Internal only, to finish a test use Datadog::CI::Test#finish
350
+ # Internal only, to finish a test use {Datadog::CI::Test#finish}
351
+ # @private
188
352
  def deactivate_test(test)
189
353
  recorder.deactivate_test(test)
190
354
  end
191
355
 
356
+ # Internal only, to finish a test session use {Datadog::CI::TestSession#finish}
357
+ # @private
358
+ def deactivate_test_session
359
+ recorder.deactivate_test_session
360
+ end
361
+
362
+ # Internal only, to finish a test module use {Datadog::CI::TestModule#finish}
363
+ # @private
364
+ def deactivate_test_module
365
+ recorder.deactivate_test_module
366
+ end
367
+
368
+ # Internal only, to finish a test suite use {Datadog::CI::TestSuite#finish}
369
+ # @private
370
+ def deactivate_test_suite(test_suite_name)
371
+ recorder.deactivate_test_suite(test_suite_name)
372
+ end
373
+
192
374
  private
193
375
 
194
376
  def components
@@ -207,6 +389,6 @@ require_relative "ci/contrib/cucumber/integration"
207
389
  require_relative "ci/contrib/rspec/integration"
208
390
  require_relative "ci/contrib/minitest/integration"
209
391
 
210
- # Extensions
211
- require_relative "ci/extensions"
212
- Datadog::CI::Extensions.activate!
392
+ # Configuration extensions
393
+ require_relative "ci/configuration/extensions"
394
+ Datadog::CI::Configuration::Extensions.activate!
@@ -0,0 +1,23 @@
1
+ module Datadog
2
+ module CI
3
+ class ConcurrentSpan < Span
4
+ @mutex: Thread::Mutex
5
+
6
+ def initialize: (Datadog::Tracing::SpanOperation tracer_span) -> void
7
+ def passed!: () -> void
8
+ def failed!: (?exception: untyped?) -> void
9
+ def skipped!: (?exception: untyped?, ?reason: String?) -> void
10
+ def get_tag: (String key) -> untyped?
11
+ def set_tag: (String key, untyped? value) -> void
12
+ def set_metric: (String key, untyped value) -> void
13
+ def finish: () -> void
14
+ def set_tags: (Hash[untyped, untyped] tags) -> void
15
+
16
+ def set_environment_runtime_tags: () -> void
17
+
18
+ def set_default_tags: () -> void
19
+
20
+ def synchronize: () { () -> untyped } -> untyped
21
+ end
22
+ end
23
+ end
@@ -2,9 +2,9 @@ module Datadog
2
2
  module CI
3
3
  module Configuration
4
4
  module Components : Datadog::Core::Configuration::Components
5
- @ci_recorder: Datadog::CI::Recorder
5
+ @ci_recorder: Datadog::CI::TestVisibility::Recorder
6
6
 
7
- attr_reader ci_recorder: Datadog::CI::Recorder
7
+ attr_reader ci_recorder: Datadog::CI::TestVisibility::Recorder
8
8
 
9
9
  def initialize: (untyped settings) -> void
10
10
 
@@ -13,6 +13,8 @@ module Datadog
13
13
  def build_agentless_transport: (untyped settings) -> Datadog::CI::TestVisibility::Transport?
14
14
  def build_evp_proxy_transport: (untyped settings, untyped agent_settings) -> Datadog::CI::TestVisibility::Transport
15
15
  def can_use_evp_proxy?: (untyped settings, untyped agent_settings) -> bool
16
+ def serializers_factory: (untyped settings) -> (singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestSuiteLevel) | singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel))
17
+ def check_dd_site: (untyped settings) -> void
16
18
  end
17
19
  end
18
20
  end
@@ -0,0 +1,9 @@
1
+ module Datadog
2
+ module CI
3
+ module Configuration
4
+ module Extensions
5
+ def self.activate!: () -> untyped
6
+ end
7
+ end
8
+ end
9
+ end
@@ -2,7 +2,12 @@ module Datadog
2
2
  module CI
3
3
  module Ext
4
4
  module AppTypes
5
- TYPE_TEST: String
5
+ TYPE_TEST: "test"
6
+ TYPE_TEST_SESSION: "test_session_end"
7
+ TYPE_TEST_MODULE: "test_module_end"
8
+ TYPE_TEST_SUITE: "test_suite_end"
9
+
10
+ CI_SPAN_TYPES: Array[String]
6
11
  end
7
12
  end
8
13
  end
@@ -5,6 +5,9 @@ module Datadog
5
5
  ENV_MODE_ENABLED: String
6
6
  ENV_AGENTLESS_MODE_ENABLED: String
7
7
  ENV_AGENTLESS_URL: String
8
+ ENV_EXPERIMENTAL_TEST_SUITE_LEVEL_VISIBILITY_ENABLED: String
9
+
10
+ DD_SITE_ALLOWLIST: Array[String]
8
11
  end
9
12
  end
10
13
  end
@@ -18,9 +18,24 @@ module Datadog
18
18
 
19
19
  TAG_SUITE: String
20
20
 
21
+ TAG_MODULE: String
22
+
21
23
  TAG_TRAITS: String
22
24
 
23
25
  TAG_TYPE: String
26
+
27
+ TAG_COMMAND: String
28
+
29
+ TAG_TEST_SESSION_ID: String
30
+
31
+ TAG_TEST_MODULE_ID: String
32
+
33
+ TAG_TEST_SUITE_ID: String
34
+
35
+ SPECIAL_TAGS: Array[String]
36
+
37
+ INHERITABLE_TAGS: Array[String]
38
+
24
39
  TAG_OS_ARCHITECTURE: String
25
40
 
26
41
  TAG_OS_PLATFORM: String
@@ -0,0 +1,37 @@
1
+ module Datadog
2
+ module CI
3
+ class NullSpan < Span
4
+ def initialize: () -> void
5
+
6
+ def id: () -> nil
7
+
8
+ def name: () -> nil
9
+
10
+ def service: () -> nil
11
+
12
+ def span_type: () -> nil
13
+
14
+ def passed!: () -> nil
15
+
16
+ def failed!: (?exception: untyped?) -> nil
17
+
18
+ def skipped!: (?exception: untyped?, ?reason: untyped?) -> nil
19
+
20
+ def get_tag: (untyped key) -> nil
21
+
22
+ def set_tag: (untyped key, untyped value) -> nil
23
+
24
+ def set_metric: (untyped key, untyped value) -> nil
25
+
26
+ def finish: () -> nil
27
+
28
+ def set_tags: (untyped tags) -> nil
29
+
30
+ def set_environment_runtime_tags: () -> nil
31
+
32
+ def set_default_tags: () -> nil
33
+
34
+ def to_s: () -> untyped
35
+ end
36
+ end
37
+ end
@@ -7,8 +7,12 @@ module Datadog
7
7
 
8
8
  def initialize: (Datadog::Tracing::SpanOperation tracer_span) -> void
9
9
 
10
+ def id: () -> Integer
11
+
10
12
  def name: () -> String
11
13
 
14
+ def service: () -> String
15
+
12
16
  def passed!: () -> void
13
17
 
14
18
  def failed!: (?exception: untyped?) -> void
@@ -0,0 +1,6 @@
1
+ module Datadog
2
+ module CI
3
+ class TestModule < ConcurrentSpan
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module Datadog
2
+ module CI
3
+ class TestSession < ConcurrentSpan
4
+ @inheritable_tags: Hash[untyped, untyped]
5
+
6
+ def inheritable_tags: () -> Hash[untyped, untyped]
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ module Datadog
2
+ module CI
3
+ class TestSuite < ConcurrentSpan
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,39 @@
1
+ module Datadog
2
+ module CI
3
+ module TestVisibility
4
+ module Context
5
+ class Global
6
+ @mutex: Thread::Mutex
7
+
8
+ @test_session: Datadog::CI::TestSession?
9
+ @test_module: Datadog::CI::TestModule?
10
+ @test_suites: Hash[String, Datadog::CI::TestSuite]
11
+
12
+ def initialize: () -> void
13
+
14
+ def fetch_or_activate_test_suite: (String test_suite_name) {() -> Datadog::CI::TestSuite} -> Datadog::CI::TestSuite
15
+
16
+ def fetch_or_activate_test_module: () {() -> Datadog::CI::TestModule} -> Datadog::CI::TestModule
17
+
18
+ def fetch_or_activate_test_session: () {() -> Datadog::CI::TestSession} -> Datadog::CI::TestSession
19
+
20
+ def active_test_session: () -> Datadog::CI::TestSession?
21
+
22
+ def active_test_suite: (String test_suite_name) -> Datadog::CI::TestSuite?
23
+
24
+ def service: () -> String?
25
+
26
+ def inheritable_session_tags: () -> Hash[untyped, untyped]
27
+
28
+ def active_test_module: () -> Datadog::CI::TestModule?
29
+
30
+ def deactivate_test_session!: () -> void
31
+
32
+ def deactivate_test_module!: () -> void
33
+
34
+ def deactivate_test_suite!: (String test_suite_name) -> void
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -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