datadog-ci 1.0.0.beta5 → 1.0.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 +20 -2
- data/README.md +15 -205
- data/lib/datadog/ci/codeowners/matcher.rb +1 -1
- data/lib/datadog/ci/codeowners/parser.rb +5 -5
- data/lib/datadog/ci/configuration/components.rb +15 -0
- data/lib/datadog/ci/contrib/contrib.rb +31 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +1 -1
- data/lib/datadog/ci/contrib/minitest/reporter.rb +1 -1
- data/lib/datadog/ci/contrib/minitest/runnable.rb +1 -1
- data/lib/datadog/ci/contrib/minitest/runner.rb +1 -1
- data/lib/datadog/ci/contrib/rspec/example.rb +8 -5
- data/lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb +1 -1
- data/lib/datadog/ci/contrib/rspec/runner.rb +1 -1
- data/lib/datadog/ci/contrib/selenium/capybara_driver.rb +45 -0
- data/lib/datadog/ci/contrib/selenium/configuration/settings.rb +32 -0
- data/lib/datadog/ci/contrib/selenium/driver.rb +45 -0
- data/lib/datadog/ci/contrib/selenium/ext.rb +30 -0
- data/lib/datadog/ci/contrib/selenium/integration.rb +48 -0
- data/lib/datadog/ci/contrib/selenium/navigation.rb +74 -0
- data/lib/datadog/ci/contrib/selenium/patcher.rb +36 -0
- data/lib/datadog/ci/contrib/selenium/rum.rb +45 -0
- data/lib/datadog/ci/ext/environment/providers/gitlab.rb +2 -2
- data/lib/datadog/ci/ext/environment.rb +1 -4
- data/lib/datadog/ci/ext/settings.rb +7 -7
- data/lib/datadog/ci/ext/test.rb +18 -5
- data/lib/datadog/ci/itr/coverage/event.rb +1 -1
- data/lib/datadog/ci/span.rb +5 -0
- data/lib/datadog/ci/test_visibility/recorder.rb +4 -0
- data/lib/datadog/ci/test_visibility/serializers/base.rb +1 -7
- data/lib/datadog/ci/test_visibility/serializers/span.rb +2 -2
- data/lib/datadog/ci/test_visibility/serializers/test_module.rb +2 -2
- data/lib/datadog/ci/test_visibility/serializers/test_session.rb +2 -2
- data/lib/datadog/ci/test_visibility/serializers/test_suite.rb +2 -2
- data/lib/datadog/ci/test_visibility/serializers/test_v1.rb +2 -2
- data/lib/datadog/ci/test_visibility/serializers/test_v2.rb +3 -3
- data/lib/datadog/ci/transport/http.rb +1 -0
- data/lib/datadog/ci/version.rb +1 -1
- data/lib/datadog/ci.rb +1 -0
- metadata +14 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f96afc61b44202e506967dc7b2d6ec956c02561a99ec7e9eae4dc26902688b7
|
4
|
+
data.tar.gz: f6d66d038f8c5a5632f6c27ed2a3c70d9f85394fca2c237825041cb523063ec4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6a548db92e125ae6fdb23301554efec581f72ca63b9a32384be33162eb90daa79ebf67ccb5834f2347b094f8d131129cd4a6963a817c55beaed83e0cd10b96b
|
7
|
+
data.tar.gz: e6da7ae7f7607955b206859e8a6c583d65aea03c59d538de2c3c7de41433a0b9942fe48e6d79db9bc7cb6546100b001dfd90b421c7ed392aa6d10e14034ecd08
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.0.0] - 2024-06-06
|
4
|
+
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
* automatically trace with correct time even when time is stubbed by timecop ([#185][])
|
8
|
+
* depend on gem datadog ~> 2.0 ([#190][])
|
9
|
+
|
10
|
+
## [1.0.0.beta6] - 2024-05-29
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
* Browser tests support via selenium integration ([#183][])
|
15
|
+
|
3
16
|
## [1.0.0.beta5] - 2024-05-23
|
4
17
|
|
5
18
|
### Changed
|
@@ -248,7 +261,9 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
248
261
|
|
249
262
|
- Ruby versions < 2.7 no longer supported ([#8][])
|
250
263
|
|
251
|
-
[Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0
|
264
|
+
[Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0...main
|
265
|
+
[1.0.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0.beta6...v1.0.0
|
266
|
+
[1.0.0.beta6]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0.beta5...v1.0.0.beta6
|
252
267
|
[1.0.0.beta5]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0.beta4...v1.0.0.beta5
|
253
268
|
[1.0.0.beta4]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0.beta3...v1.0.0.beta4
|
254
269
|
[1.0.0.beta3]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0.beta2...v1.0.0.beta3
|
@@ -350,4 +365,7 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
350
365
|
[#173]: https://github.com/DataDog/datadog-ci-rb/issues/173
|
351
366
|
[#174]: https://github.com/DataDog/datadog-ci-rb/issues/174
|
352
367
|
[#175]: https://github.com/DataDog/datadog-ci-rb/issues/175
|
353
|
-
[#180]: https://github.com/DataDog/datadog-ci-rb/issues/180
|
368
|
+
[#180]: https://github.com/DataDog/datadog-ci-rb/issues/180
|
369
|
+
[#183]: https://github.com/DataDog/datadog-ci-rb/issues/183
|
370
|
+
[#185]: https://github.com/DataDog/datadog-ci-rb/issues/185
|
371
|
+
[#190]: https://github.com/DataDog/datadog-ci-rb/issues/190
|
data/README.md
CHANGED
@@ -1,13 +1,23 @@
|
|
1
|
-
# Datadog
|
1
|
+
# Datadog Test Visibility for Ruby
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/datadog-ci.svg)](https://badge.fury.io/rb/datadog-ci)
|
4
4
|
[![YARD documentation](https://img.shields.io/badge/YARD-documentation-blue)](https://datadoghq.dev/datadog-ci-rb/)
|
5
5
|
[![codecov](https://codecov.io/gh/DataDog/datadog-ci-rb/branch/main/graph/badge.svg)](https://app.codecov.io/gh/DataDog/datadog-ci-rb/branch/main)
|
6
6
|
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/DataDog/datadog-ci-rb/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/DataDog/datadog-ci-rb/tree/main)
|
7
7
|
|
8
|
-
Datadog's Ruby Library for instrumenting your
|
8
|
+
Datadog's Ruby Library for instrumenting your tests.
|
9
9
|
Learn more on our [official website](https://docs.datadoghq.com/tests/) and check out our [documentation for this library](https://docs.datadoghq.com/tests/setup/ruby/?tab=cloudciprovideragentless).
|
10
10
|
|
11
|
+
## Features
|
12
|
+
|
13
|
+
- [Test Visibility](https://docs.datadoghq.com/tests/) - collect metrics and results for your tests
|
14
|
+
- [Intelligent test runner](https://docs.datadoghq.com/intelligent_test_runner/) - save time by selectively running only tests affected by code changes
|
15
|
+
- [Search and manage CI tests](https://docs.datadoghq.com/tests/search/)
|
16
|
+
- [Enhance developer workflows](https://docs.datadoghq.com/tests/developer_workflows)
|
17
|
+
- [Flaky test management](https://docs.datadoghq.com/tests/guides/flaky_test_management/)
|
18
|
+
- [Add custom measures to your tests](https://docs.datadoghq.com/tests/guides/add_custom_measures/?tab=ruby)
|
19
|
+
- [Browser tests integration with Datadog RUM](https://docs.datadoghq.com/tests/browser_tests)
|
20
|
+
|
11
21
|
## Installation
|
12
22
|
|
13
23
|
Add to your Gemfile.
|
@@ -22,210 +32,10 @@ end
|
|
22
32
|
|
23
33
|
If you used [test visibility for Ruby](https://docs.datadoghq.com/tests/setup/ruby/) with [ddtrace](https://github.com/datadog/dd-trace-rb) gem, check out our [upgrade guide](/docs/UpgradeGuide.md).
|
24
34
|
|
25
|
-
##
|
26
|
-
|
27
|
-
### RSpec
|
28
|
-
|
29
|
-
To activate `RSpec` integration, add this to the `spec_helper.rb` file:
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
require 'rspec'
|
33
|
-
require 'datadog/ci'
|
34
|
-
|
35
|
-
# Only activates test instrumentation on CI
|
36
|
-
if ENV["DD_ENV"] == "ci"
|
37
|
-
Datadog.configure do |c|
|
38
|
-
# The name of the service or library under test
|
39
|
-
c.service = 'my-ruby-app'
|
40
|
-
c.ci.enabled = true
|
41
|
-
c.ci.instrument :rspec
|
42
|
-
end
|
43
|
-
end
|
44
|
-
```
|
45
|
-
|
46
|
-
### Minitest
|
47
|
-
|
48
|
-
The Minitest integration will trace all executions of tests when using `minitest` test framework.
|
49
|
-
|
50
|
-
To activate your integration, use the `Datadog.configure` method:
|
51
|
-
|
52
|
-
```ruby
|
53
|
-
require 'minitest'
|
54
|
-
require 'datadog/ci'
|
55
|
-
|
56
|
-
# Only activates test instrumentation on CI
|
57
|
-
if ENV["DD_ENV"] == "ci"
|
58
|
-
# Configure default Minitest integration
|
59
|
-
Datadog.configure do |c|
|
60
|
-
# The name of the service or library under test
|
61
|
-
c.service = 'my-ruby-app'
|
62
|
-
c.ci.enabled = true
|
63
|
-
c.ci.instrument :minitest
|
64
|
-
end
|
65
|
-
end
|
66
|
-
```
|
67
|
-
|
68
|
-
> [!IMPORTANT]
|
69
|
-
> When using `minitest/autorun` the order of requires matters: `datadog/ci` must be
|
70
|
-
> always required before `minitest/autorun`.
|
71
|
-
|
72
|
-
Example using `minitest/autorun`
|
73
|
-
|
74
|
-
```ruby
|
75
|
-
require 'datadog/ci'
|
76
|
-
require 'minitest/autorun'
|
77
|
-
|
78
|
-
if ENV["DD_ENV"] == "ci"
|
79
|
-
Datadog.configure do |c|
|
80
|
-
c.service = 'my-ruby-app'
|
81
|
-
c.ci.enabled = true
|
82
|
-
c.ci.instrument :minitest
|
83
|
-
end
|
84
|
-
end
|
85
|
-
```
|
86
|
-
|
87
|
-
### Cucumber
|
88
|
-
|
89
|
-
Activate `Cucumber` integration with configuration
|
90
|
-
|
91
|
-
```ruby
|
92
|
-
require 'cucumber'
|
93
|
-
require 'datadog/ci'
|
94
|
-
|
95
|
-
# Only activates test instrumentation on CI
|
96
|
-
if ENV["DD_ENV"] == "ci"
|
97
|
-
Datadog.configure do |c|
|
98
|
-
# The name of the service or library under test
|
99
|
-
c.service = 'my-ruby-app'
|
100
|
-
c.ci.enabled = true
|
101
|
-
c.ci.instrument :cucumber
|
102
|
-
end
|
103
|
-
end
|
104
|
-
```
|
105
|
-
|
106
|
-
### Instrumentation options
|
107
|
-
|
108
|
-
Configuration `ci.instrument` accepts the following optional parameters:
|
35
|
+
## Setup
|
109
36
|
|
110
|
-
-
|
111
|
-
-
|
112
|
-
|
113
|
-
Example usage:
|
114
|
-
|
115
|
-
```ruby
|
116
|
-
Datadog.configure do |c|
|
117
|
-
c.service = 'my-ruby-app'
|
118
|
-
c.ci.enabled = true
|
119
|
-
c.ci.instrument :cucumber, service_name: 'my-cucumber-features', enabled: true
|
120
|
-
c.ci.instrument :minitest, service_name: 'my-unit-tests', enabled: false
|
121
|
-
end
|
122
|
-
```
|
123
|
-
|
124
|
-
## Agentless mode
|
125
|
-
|
126
|
-
If you are using a cloud CI provider without access to the underlying worker nodes, such as GitHub Actions or CircleCI, configure the library to use the Agentless mode. For this, set the following environment variables:
|
127
|
-
`DD_CIVISIBILITY_AGENTLESS_ENABLED=true (Required)` and `DD_API_KEY=your_secret_api_key (Required)`.
|
128
|
-
|
129
|
-
Additionally, configure which [Datadog site](https://docs.datadoghq.com/getting_started/site/) you want to send data to:
|
130
|
-
`DD_SITE=your.datadoghq.com` (datadoghq.com by default).
|
131
|
-
|
132
|
-
Agentless mode can also be enabled via `Datadog.configure` (but don't forget to set DD_API_KEY environment variable):
|
133
|
-
|
134
|
-
```ruby
|
135
|
-
Datadog.configure { |c| c.ci.agentless_mode_enabled = true }
|
136
|
-
```
|
137
|
-
|
138
|
-
## Additional configuration
|
139
|
-
|
140
|
-
### Add tracing instrumentations
|
141
|
-
|
142
|
-
It can be useful to have rich tracing information about your tests that includes time spent performing database operations
|
143
|
-
or other external calls like here:
|
144
|
-
|
145
|
-
![Test trace with redis instrumented](./docs/screenshots/test-trace-with-redis.png)
|
146
|
-
|
147
|
-
To achieve this, add Datadog tracing instrumentations in your `Datadog.configure` block:
|
148
|
-
|
149
|
-
```ruby
|
150
|
-
Datadog.configure do |c|
|
151
|
-
# ... ci configs and instrumentation here ...
|
152
|
-
c.tracing.instrument :redis
|
153
|
-
c.tracing.instrument :pg
|
154
|
-
end
|
155
|
-
```
|
156
|
-
|
157
|
-
...or enable auto instrumentation in your test_helper/spec_helper:
|
158
|
-
|
159
|
-
```ruby
|
160
|
-
require "datadog/auto_instrument"
|
161
|
-
```
|
162
|
-
|
163
|
-
Note: in CI mode these traces are going to be submitted to CI Visibility,
|
164
|
-
they will **not** show up in Datadog APM.
|
165
|
-
|
166
|
-
For the full list of available instrumentations see [datadog documentation](https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md)
|
167
|
-
|
168
|
-
### WebMock
|
169
|
-
|
170
|
-
[WebMock](https://github.com/bblimke/webmock)
|
171
|
-
is a popular Ruby library that stubs HTTP requests when running tests.
|
172
|
-
By default it fails when used together with datadog-ci as traces are being sent
|
173
|
-
to Datadog via HTTP calls.
|
174
|
-
|
175
|
-
In order to allow HTTP connections for Datadog backend you would need to configure
|
176
|
-
Webmock accordingly.
|
177
|
-
|
178
|
-
```ruby
|
179
|
-
# when using agentless mode
|
180
|
-
WebMock.disable_net_connect!(:allow => /datadoghq/)
|
181
|
-
|
182
|
-
# when using agent
|
183
|
-
WebMock.disable_net_connect!(:allow_localhost => true)
|
184
|
-
|
185
|
-
# or for more granular setting set your agent URL
|
186
|
-
WebMock.disable_net_connect!(:allow => "localhost:8126")
|
187
|
-
```
|
188
|
-
|
189
|
-
### VCR
|
190
|
-
|
191
|
-
[VCR](https://github.com/vcr/vcr) is another popular testing library for HTTP interactions.
|
192
|
-
|
193
|
-
It requires additional configuration to correctly work with datadog-ci:
|
194
|
-
|
195
|
-
```ruby
|
196
|
-
VCR.configure do |config|
|
197
|
-
# ... your usual configuration here ...
|
198
|
-
|
199
|
-
# when using agent
|
200
|
-
config.ignore_hosts "127.0.0.1", "localhost"
|
201
|
-
|
202
|
-
# when using agentless mode
|
203
|
-
config.ignore_request do |request|
|
204
|
-
# ignore all requests to datadoghq hosts
|
205
|
-
request.uri =~ /datadoghq/
|
206
|
-
end
|
207
|
-
end
|
208
|
-
```
|
209
|
-
|
210
|
-
### Disabling startup logs
|
211
|
-
|
212
|
-
Startup logs produce a report of tracing state when the application is initially configured.
|
213
|
-
These logs are activated by default in test mode, if you don't want them you can disable this
|
214
|
-
via `DD_TRACE_STARTUP_LOGS=0` or in the `Datadog.configure` block:
|
215
|
-
|
216
|
-
```ruby
|
217
|
-
Datadog.configure { |c| c.diagnostics.startup_logs.enabled = false }
|
218
|
-
```
|
219
|
-
|
220
|
-
### Enabling debug mode
|
221
|
-
|
222
|
-
Switching the library into debug mode will produce verbose, detailed logs about tracing activity, including any suppressed errors. This output can be helpful in identifying errors, confirming trace output, or catching HTTP transport issues.
|
223
|
-
|
224
|
-
You can enable this via `DD_TRACE_DEBUG=1` or in the `Datadog.configure` block:
|
225
|
-
|
226
|
-
```ruby
|
227
|
-
Datadog.configure { |c| c.diagnostics.debug = true }
|
228
|
-
```
|
37
|
+
- [Test visibility setup](https://docs.datadoghq.com/tests/setup/ruby/?tab=cloudciprovideragentless)
|
38
|
+
- [Intelligent test runner setup](https://docs.datadoghq.com/intelligent_test_runner/setup/ruby) (test visibility setup is required before setting up intelligent test runner)
|
229
39
|
|
230
40
|
## Contributing
|
231
41
|
|
@@ -87,7 +87,7 @@ module Datadog
|
|
87
87
|
return pattern if pattern == "*"
|
88
88
|
|
89
89
|
# if pattern ends with a slash then it matches everything deeply nested in this directory
|
90
|
-
pattern
|
90
|
+
pattern << "**" if pattern.end_with?(::File::SEPARATOR)
|
91
91
|
|
92
92
|
# if pattern doesn't start with a slash then it matches anywhere in the repository
|
93
93
|
if !pattern.start_with?(::File::SEPARATOR, "**#{::File::SEPARATOR}", "*#{::File::SEPARATOR}")
|
@@ -8,11 +8,11 @@ module Datadog
|
|
8
8
|
# Responsible for parsing a CODEOWNERS file
|
9
9
|
class Parser
|
10
10
|
DEFAULT_LOCATION = "CODEOWNERS"
|
11
|
-
POSSIBLE_CODEOWNERS_LOCATIONS = [
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
POSSIBLE_CODEOWNERS_LOCATIONS = %w[
|
12
|
+
CODEOWNERS
|
13
|
+
.github/CODEOWNERS
|
14
|
+
.gitlab/CODEOWNERS
|
15
|
+
docs/CODEOWNERS
|
16
16
|
].freeze
|
17
17
|
|
18
18
|
def initialize(root_file_path)
|
@@ -70,6 +70,17 @@ module Datadog
|
|
70
70
|
# Choose user defined TraceFlush or default to CI TraceFlush
|
71
71
|
settings.tracing.test_mode.trace_flush = settings.ci.trace_flush || CI::TestVisibility::Flush::Partial.new
|
72
72
|
|
73
|
+
# When timecop is present, Time.now is mocked and .now_without_mock_time is added on Time to
|
74
|
+
# get the current time without the mock.
|
75
|
+
if timecop?
|
76
|
+
settings.time_now_provider = -> do
|
77
|
+
Time.now_without_mock_time
|
78
|
+
rescue NoMethodError
|
79
|
+
# fallback to normal Time.now if Time.now_without_mock_time is not defined for any reason
|
80
|
+
Time.now
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
73
84
|
# startup logs are useless for CI visibility and create noise
|
74
85
|
settings.diagnostics.startup_logs.enabled = false
|
75
86
|
|
@@ -191,6 +202,10 @@ module Datadog
|
|
191
202
|
"Please make sure to set valid site in DD_SITE environment variable"
|
192
203
|
end
|
193
204
|
end
|
205
|
+
|
206
|
+
def timecop?
|
207
|
+
Gem.loaded_specs.key?("timecop") || defined?(Timecop)
|
208
|
+
end
|
194
209
|
end
|
195
210
|
end
|
196
211
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "integration"
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module CI
|
7
|
+
module Contrib
|
8
|
+
# This method auto instruments all test libraries (ex: selenium-webdriver).
|
9
|
+
# It is intended to be called when test session starts to add additional capabilities to test visibility.
|
10
|
+
#
|
11
|
+
# This method does not automatically instrument test frameworks (ex: RSpec, Cucumber, etc), it requires
|
12
|
+
# test framework to be already instrumented.
|
13
|
+
def self.auto_instrument_on_session_start!
|
14
|
+
Datadog.logger.debug("Auto instrumenting all integrations...")
|
15
|
+
|
16
|
+
Integration.registry.each do |name, integration|
|
17
|
+
next unless integration.auto_instrument?
|
18
|
+
|
19
|
+
Datadog.logger.debug "#{name} is allowed to be auto instrumented"
|
20
|
+
|
21
|
+
patch_results = integration.patch
|
22
|
+
if patch_results == true
|
23
|
+
Datadog.logger.debug("#{name} is patched")
|
24
|
+
else
|
25
|
+
Datadog.logger.debug("#{name} is not patched (#{patch_results})")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -187,7 +187,7 @@ module Datadog
|
|
187
187
|
def ok?(result, strict)
|
188
188
|
# in minor update in Cucumber 9.2.0, the arity of the `ok?` method changed
|
189
189
|
parameters = result.method(:ok?).parameters
|
190
|
-
if parameters == [[
|
190
|
+
if parameters == [%i[opt be_strict]]
|
191
191
|
result.ok?(strict)
|
192
192
|
else
|
193
193
|
result.ok?(strict: strict)
|
@@ -16,14 +16,14 @@ module Datadog
|
|
16
16
|
end
|
17
17
|
|
18
18
|
module InstanceMethods
|
19
|
-
def run(*)
|
19
|
+
def run(*args)
|
20
20
|
return super if ::RSpec.configuration.dry_run?
|
21
21
|
return super unless datadog_configuration[:enabled]
|
22
22
|
|
23
23
|
test_name = full_description.strip
|
24
24
|
if metadata[:description].empty?
|
25
25
|
# for unnamed it blocks this appends something like "example at ./spec/some_spec.rb:10"
|
26
|
-
test_name
|
26
|
+
test_name << " #{description}"
|
27
27
|
end
|
28
28
|
|
29
29
|
test_suite_description = fetch_top_level_example_group[:description]
|
@@ -33,7 +33,7 @@ module Datadog
|
|
33
33
|
test_name = test_name.sub(test_suite_description, "").strip
|
34
34
|
|
35
35
|
if ci_queue?
|
36
|
-
suite_name
|
36
|
+
suite_name = "#{suite_name} (ci-queue running example [#{test_name}])"
|
37
37
|
test_suite_span = CI.start_test_suite(suite_name)
|
38
38
|
end
|
39
39
|
|
@@ -83,9 +83,12 @@ module Datadog
|
|
83
83
|
private
|
84
84
|
|
85
85
|
def fetch_top_level_example_group
|
86
|
-
|
86
|
+
example_group = metadata[:example_group]
|
87
|
+
parent_example_group = example_group[:parent_example_group]
|
87
88
|
|
88
|
-
|
89
|
+
return example_group unless parent_example_group
|
90
|
+
|
91
|
+
res = parent_example_group
|
89
92
|
while (parent = res[:parent_example_group])
|
90
93
|
res = parent
|
91
94
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "datadog/tracing/contrib/patcher"
|
4
|
+
|
5
|
+
require_relative "ext"
|
6
|
+
require_relative "rum"
|
7
|
+
require_relative "../../ext/test"
|
8
|
+
|
9
|
+
module Datadog
|
10
|
+
module CI
|
11
|
+
module Contrib
|
12
|
+
module Selenium
|
13
|
+
# instruments Capybara::Selenium::Driver
|
14
|
+
module CapybaraDriver
|
15
|
+
def self.included(base)
|
16
|
+
base.prepend(InstanceMethods)
|
17
|
+
end
|
18
|
+
|
19
|
+
module InstanceMethods
|
20
|
+
def reset!
|
21
|
+
return super unless datadog_configuration[:enabled]
|
22
|
+
|
23
|
+
Datadog.logger.debug("[Selenium] Capybara session reset event")
|
24
|
+
|
25
|
+
RUM.stop_rum_session(@browser)
|
26
|
+
|
27
|
+
Datadog.logger.debug("[Selenium] RUM session stopped, deleting cookie")
|
28
|
+
@browser.manage.delete_cookie(Ext::COOKIE_TEST_EXECUTION_ID)
|
29
|
+
rescue ::Selenium::WebDriver::Error::WebDriverError => e
|
30
|
+
Datadog.logger.debug("[Selenium] Error while resetting Capybara session: #{e.message}")
|
31
|
+
ensure
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def datadog_configuration
|
38
|
+
Datadog.configuration.ci[:selenium]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "datadog/core"
|
4
|
+
|
5
|
+
require_relative "../ext"
|
6
|
+
require_relative "../../settings"
|
7
|
+
|
8
|
+
module Datadog
|
9
|
+
module CI
|
10
|
+
module Contrib
|
11
|
+
module Selenium
|
12
|
+
module Configuration
|
13
|
+
# Custom settings for the Selenium integration
|
14
|
+
# @public_api
|
15
|
+
class Settings < Datadog::CI::Contrib::Settings
|
16
|
+
option :enabled do |o|
|
17
|
+
o.type :bool
|
18
|
+
o.env Ext::ENV_ENABLED
|
19
|
+
o.default true
|
20
|
+
end
|
21
|
+
|
22
|
+
option :rum_flush_wait_millis do |o|
|
23
|
+
o.type :int
|
24
|
+
o.env Ext::ENV_RUM_FLUSH_WAIT_MILLIS
|
25
|
+
o.default 500
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "datadog/tracing/contrib/patcher"
|
4
|
+
|
5
|
+
require_relative "ext"
|
6
|
+
require_relative "rum"
|
7
|
+
require_relative "../../ext/test"
|
8
|
+
|
9
|
+
module Datadog
|
10
|
+
module CI
|
11
|
+
module Contrib
|
12
|
+
module Selenium
|
13
|
+
# instruments Selenium::WebDriver::Driver
|
14
|
+
module Driver
|
15
|
+
def self.included(base)
|
16
|
+
base.prepend(InstanceMethods)
|
17
|
+
end
|
18
|
+
|
19
|
+
module InstanceMethods
|
20
|
+
def quit
|
21
|
+
return super unless datadog_configuration[:enabled]
|
22
|
+
|
23
|
+
Datadog.logger.debug("[Selenium] Driver quit event")
|
24
|
+
|
25
|
+
RUM.stop_rum_session(@bridge)
|
26
|
+
|
27
|
+
Datadog.logger.debug("[Selenium] RUM session stopped, deleting cookie")
|
28
|
+
@bridge.manage.delete_cookie(Ext::COOKIE_TEST_EXECUTION_ID)
|
29
|
+
rescue ::Selenium::WebDriver::Error::WebDriverError => e
|
30
|
+
Datadog.logger.debug("[Selenium] Error while quitting Selenium driver: #{e.message}")
|
31
|
+
ensure
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def datadog_configuration
|
38
|
+
Datadog.configuration.ci[:selenium]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module CI
|
5
|
+
module Contrib
|
6
|
+
module Selenium
|
7
|
+
# Selenium integration constants
|
8
|
+
# @public_api
|
9
|
+
module Ext
|
10
|
+
ENV_ENABLED = "DD_CIVISIBILITY_SELENIUM_ENABLED"
|
11
|
+
ENV_RUM_FLUSH_WAIT_MILLIS = "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS"
|
12
|
+
|
13
|
+
COOKIE_TEST_EXECUTION_ID = "datadog-ci-visibility-test-execution-id"
|
14
|
+
|
15
|
+
SCRIPT_IS_RUM_ACTIVE = <<~JS
|
16
|
+
return !!window.DD_RUM
|
17
|
+
JS
|
18
|
+
SCRIPT_STOP_RUM_SESSION = <<~JS
|
19
|
+
if (window.DD_RUM && window.DD_RUM.stopSession) {
|
20
|
+
window.DD_RUM.stopSession();
|
21
|
+
return true;
|
22
|
+
} else {
|
23
|
+
return false;
|
24
|
+
}
|
25
|
+
JS
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../integration"
|
4
|
+
require_relative "configuration/settings"
|
5
|
+
require_relative "patcher"
|
6
|
+
|
7
|
+
module Datadog
|
8
|
+
module CI
|
9
|
+
module Contrib
|
10
|
+
module Selenium
|
11
|
+
# Description of Selenium integration
|
12
|
+
class Integration
|
13
|
+
include Datadog::CI::Contrib::Integration
|
14
|
+
|
15
|
+
MINIMUM_VERSION = Gem::Version.new("4.0.0")
|
16
|
+
|
17
|
+
register_as :selenium
|
18
|
+
|
19
|
+
def self.version
|
20
|
+
Gem.loaded_specs["selenium-webdriver"]&.version
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.loaded?
|
24
|
+
!defined?(::Selenium).nil? && !defined?(::Selenium::WebDriver).nil? &&
|
25
|
+
!defined?(::Selenium::WebDriver::Driver).nil?
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.compatible?
|
29
|
+
super && version >= MINIMUM_VERSION
|
30
|
+
end
|
31
|
+
|
32
|
+
# additional instrumentations for test helpers are auto instrumented on test session start
|
33
|
+
def auto_instrument?
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
37
|
+
def new_configuration
|
38
|
+
Configuration::Settings.new
|
39
|
+
end
|
40
|
+
|
41
|
+
def patcher
|
42
|
+
Patcher
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "datadog/tracing/contrib/patcher"
|
4
|
+
|
5
|
+
require_relative "ext"
|
6
|
+
require_relative "../../ext/test"
|
7
|
+
|
8
|
+
module Datadog
|
9
|
+
module CI
|
10
|
+
module Contrib
|
11
|
+
module Selenium
|
12
|
+
# instruments Selenium::WebDriver::Navigation
|
13
|
+
module Navigation
|
14
|
+
def self.included(base)
|
15
|
+
base.prepend(InstanceMethods)
|
16
|
+
end
|
17
|
+
|
18
|
+
module InstanceMethods
|
19
|
+
def to(url)
|
20
|
+
result = super
|
21
|
+
|
22
|
+
return result unless datadog_configuration[:enabled]
|
23
|
+
|
24
|
+
Datadog.logger.debug("[Selenium] Navigation to #{url}")
|
25
|
+
|
26
|
+
# on session reset Capybara navigates to about:blank
|
27
|
+
return result if url == "about:blank"
|
28
|
+
|
29
|
+
active_test = Datadog::CI.active_test
|
30
|
+
Datadog.logger.debug("[Selenium] Active test: #{active_test}")
|
31
|
+
|
32
|
+
return result unless active_test
|
33
|
+
|
34
|
+
# Set the test's trace id as a cookie in browser session
|
35
|
+
cookie_hash = {name: Ext::COOKIE_TEST_EXECUTION_ID, value: active_test.trace_id.to_s}
|
36
|
+
Datadog.logger.debug { "[Selenium] Setting cookie: #{cookie_hash}" }
|
37
|
+
@bridge.manage.add_cookie(cookie_hash)
|
38
|
+
|
39
|
+
# set the test type to browser
|
40
|
+
active_test.set_tag(CI::Ext::Test::TAG_TYPE, CI::Ext::Test::Type::BROWSER)
|
41
|
+
|
42
|
+
# set the tags specific to the browser test
|
43
|
+
active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER, "selenium")
|
44
|
+
active_test.set_tag(
|
45
|
+
CI::Ext::Test::TAG_BROWSER_DRIVER_VERSION,
|
46
|
+
Integration.version
|
47
|
+
)
|
48
|
+
active_test.set_tag(
|
49
|
+
CI::Ext::Test::TAG_BROWSER_NAME,
|
50
|
+
@bridge.browser
|
51
|
+
)
|
52
|
+
active_test.set_tag(
|
53
|
+
CI::Ext::Test::TAG_BROWSER_VERSION,
|
54
|
+
@bridge.capabilities.browser_version
|
55
|
+
)
|
56
|
+
|
57
|
+
result
|
58
|
+
rescue ::Selenium::WebDriver::Error::WebDriverError => e
|
59
|
+
Datadog.logger.debug("[Selenium] Error while navigating: #{e.message}")
|
60
|
+
|
61
|
+
result
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def datadog_configuration
|
67
|
+
Datadog.configuration.ci[:selenium]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "datadog/tracing/contrib/patcher"
|
4
|
+
|
5
|
+
require_relative "capybara_driver"
|
6
|
+
require_relative "driver"
|
7
|
+
require_relative "navigation"
|
8
|
+
|
9
|
+
module Datadog
|
10
|
+
module CI
|
11
|
+
module Contrib
|
12
|
+
module Selenium
|
13
|
+
# Patcher enables patching of 'Selenium::WebDriver' module.
|
14
|
+
module Patcher
|
15
|
+
include Datadog::Tracing::Contrib::Patcher
|
16
|
+
|
17
|
+
module_function
|
18
|
+
|
19
|
+
def target_version
|
20
|
+
Integration.version
|
21
|
+
end
|
22
|
+
|
23
|
+
def patch
|
24
|
+
::Selenium::WebDriver::Driver.include(Driver)
|
25
|
+
::Selenium::WebDriver::Navigation.include(Navigation)
|
26
|
+
|
27
|
+
# capybara calls `reset!` after each test, so we need to patch it as well
|
28
|
+
if defined?(::Capybara::Selenium::Driver)
|
29
|
+
::Capybara::Selenium::Driver.include(CapybaraDriver)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "datadog/tracing/contrib/patcher"
|
4
|
+
|
5
|
+
require_relative "ext"
|
6
|
+
require_relative "../../ext/test"
|
7
|
+
require_relative "../../utils/parsing"
|
8
|
+
|
9
|
+
module Datadog
|
10
|
+
module CI
|
11
|
+
module Contrib
|
12
|
+
module Selenium
|
13
|
+
# Provides functionality to interact with Datadog Real User Monitoring product
|
14
|
+
# via executing JavaScript code in the browser.
|
15
|
+
#
|
16
|
+
# Relevant docs: https://docs.datadoghq.com/real_user_monitoring/browser/
|
17
|
+
module RUM
|
18
|
+
def self.is_rum_active?(script_executor)
|
19
|
+
is_rum_active_script_result = script_executor.execute_script(Ext::SCRIPT_IS_RUM_ACTIVE)
|
20
|
+
Datadog.logger.debug { "[Selenium] SCRIPT_IS_RUM_ACTIVE result is #{is_rum_active_script_result.inspect}" }
|
21
|
+
Utils::Parsing.convert_to_bool(is_rum_active_script_result)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.stop_rum_session(script_executor)
|
25
|
+
config = Datadog.configuration.ci[:selenium]
|
26
|
+
if is_rum_active?(script_executor)
|
27
|
+
Datadog::CI.active_test&.set_tag(
|
28
|
+
CI::Ext::Test::TAG_IS_RUM_ACTIVE,
|
29
|
+
"true"
|
30
|
+
)
|
31
|
+
|
32
|
+
result = script_executor.execute_script(Ext::SCRIPT_STOP_RUM_SESSION)
|
33
|
+
Datadog.logger.debug { "[Selenium] SCRIPT_STOP_RUM_SESSION result is #{result.inspect}" }
|
34
|
+
|
35
|
+
# introduce a delay to allow the RUM session to be stopped
|
36
|
+
delay = config[:rum_flush_wait_millis] / 1000.0
|
37
|
+
Datadog.logger.debug { "[Selenium] Waiting for #{delay} seconds" }
|
38
|
+
sleep(delay)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -75,12 +75,12 @@ module Datadog
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def git_commit_author_name
|
78
|
-
name,
|
78
|
+
name, _email = extract_name_email
|
79
79
|
name
|
80
80
|
end
|
81
81
|
|
82
82
|
def git_commit_author_email
|
83
|
-
|
83
|
+
_name, email = extract_name_email
|
84
84
|
email
|
85
85
|
end
|
86
86
|
|
@@ -23,10 +23,7 @@ module Datadog
|
|
23
23
|
TAG_NODE_NAME = "ci.node.name"
|
24
24
|
TAG_CI_ENV_VARS = "_dd.ci.env_vars"
|
25
25
|
|
26
|
-
POSSIBLE_BUNDLE_LOCATIONS = [
|
27
|
-
"vendor/bundle",
|
28
|
-
".bundle"
|
29
|
-
].freeze
|
26
|
+
POSSIBLE_BUNDLE_LOCATIONS = %w[vendor/bundle .bundle].freeze
|
30
27
|
|
31
28
|
module_function
|
32
29
|
|
@@ -15,13 +15,13 @@ module Datadog
|
|
15
15
|
ENV_ITR_CODE_COVERAGE_EXCLUDED_BUNDLE_PATH = "DD_CIVISIBILITY_ITR_CODE_COVERAGE_EXCLUDED_BUNDLE_PATH"
|
16
16
|
|
17
17
|
# Source: https://docs.datadoghq.com/getting_started/site/
|
18
|
-
DD_SITE_ALLOWLIST = [
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
DD_SITE_ALLOWLIST = %w[
|
19
|
+
datadoghq.com
|
20
|
+
us3.datadoghq.com
|
21
|
+
us5.datadoghq.com
|
22
|
+
datadoghq.eu
|
23
|
+
ddog-gov.com
|
24
|
+
ap1.datadoghq.com
|
25
25
|
].freeze
|
26
26
|
end
|
27
27
|
end
|
data/lib/datadog/ci/ext/test.rb
CHANGED
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
module Test
|
9
9
|
CONTEXT_ORIGIN = "ciapp-test"
|
10
10
|
|
11
|
+
# Base test visibility tags
|
11
12
|
TAG_FRAMEWORK = "test.framework"
|
12
13
|
TAG_FRAMEWORK_VERSION = "test.framework_version"
|
13
14
|
TAG_NAME = "test.name"
|
@@ -34,16 +35,13 @@ module Datadog
|
|
34
35
|
# Code coverage tags
|
35
36
|
TAG_CODE_COVERAGE_ENABLED = "test.code_coverage.enabled"
|
36
37
|
|
37
|
-
#
|
38
|
-
#
|
38
|
+
# Special tags, not sent to the backend.
|
39
|
+
# these tags are special and used to correlate tests with the test sessions, suites, and modules
|
39
40
|
TAG_TEST_SESSION_ID = "_test.session_id"
|
40
41
|
TAG_TEST_MODULE_ID = "_test.module_id"
|
41
42
|
TAG_TEST_SUITE_ID = "_test.suite_id"
|
42
43
|
TRANSIENT_TAGS = [TAG_TEST_SESSION_ID, TAG_TEST_MODULE_ID, TAG_TEST_SUITE_ID].freeze
|
43
44
|
|
44
|
-
# tags that are common for the whole session and can be inherited from the test session
|
45
|
-
INHERITABLE_TAGS = [TAG_FRAMEWORK, TAG_FRAMEWORK_VERSION].freeze
|
46
|
-
|
47
45
|
# Environment runtime tags
|
48
46
|
TAG_OS_ARCHITECTURE = "os.architecture"
|
49
47
|
TAG_OS_PLATFORM = "os.platform"
|
@@ -51,10 +49,24 @@ module Datadog
|
|
51
49
|
TAG_RUNTIME_NAME = "runtime.name"
|
52
50
|
TAG_RUNTIME_VERSION = "runtime.version"
|
53
51
|
|
52
|
+
# Tags for browser tests
|
53
|
+
# true if Datadog RUM was detected in the page(s) loaded by Selenium
|
54
|
+
TAG_IS_RUM_ACTIVE = "test.is_rum_active"
|
55
|
+
TAG_BROWSER_DRIVER = "test.browser.driver"
|
56
|
+
# version of selenium driver used
|
57
|
+
TAG_BROWSER_DRIVER_VERSION = "test.browser.driver_version"
|
58
|
+
# name of the browser (Chrome, Firefox, Edge, etc), if multiple browsers then this tag is empty
|
59
|
+
TAG_BROWSER_NAME = "test.browser.name"
|
60
|
+
# version of the browser, if multiple browsers or multiple versions then this tag is empty
|
61
|
+
TAG_BROWSER_VERSION = "test.browser.version"
|
62
|
+
|
54
63
|
# internal APM tag to mark a span as a test span
|
55
64
|
TAG_SPAN_KIND = "span.kind"
|
56
65
|
SPAN_KIND_TEST = "test"
|
57
66
|
|
67
|
+
# tags that are common for the whole session and can be inherited from the test session
|
68
|
+
INHERITABLE_TAGS = [TAG_FRAMEWORK, TAG_FRAMEWORK_VERSION].freeze
|
69
|
+
|
58
70
|
# could be either "test" or "suite" depending on whether we skip individual tests or whole suites
|
59
71
|
# we use test skipping for Ruby
|
60
72
|
ITR_TEST_SKIPPING_MODE = "test"
|
@@ -71,6 +83,7 @@ module Datadog
|
|
71
83
|
# test types (e.g. test, benchmark, browser)
|
72
84
|
module Type
|
73
85
|
TEST = "test"
|
86
|
+
BROWSER = "browser"
|
74
87
|
BENCHMARK = "benchmark" # DEV: not used yet, will be used when benchmarks are supported
|
75
88
|
end
|
76
89
|
end
|
@@ -21,7 +21,7 @@ module Datadog
|
|
21
21
|
def valid?
|
22
22
|
valid = true
|
23
23
|
|
24
|
-
[
|
24
|
+
%i[test_id test_suite_id test_session_id coverage].each do |key|
|
25
25
|
next unless send(key).nil?
|
26
26
|
|
27
27
|
Datadog.logger.warn("citestcov event is invalid: [#{key}] is nil. Event: #{self}")
|
data/lib/datadog/ci/span.rb
CHANGED
@@ -10,6 +10,7 @@ require_relative "context/global"
|
|
10
10
|
require_relative "context/local"
|
11
11
|
|
12
12
|
require_relative "../codeowners/parser"
|
13
|
+
require_relative "../contrib/contrib"
|
13
14
|
require_relative "../ext/app_types"
|
14
15
|
require_relative "../ext/test"
|
15
16
|
require_relative "../ext/environment"
|
@@ -57,6 +58,9 @@ module Datadog
|
|
57
58
|
def start_test_session(service: nil, tags: {})
|
58
59
|
return skip_tracing unless test_suite_level_visibility_enabled
|
59
60
|
|
61
|
+
# finds and instruments additional test libraries that we support (ex: selenium-webdriver)
|
62
|
+
Contrib.auto_instrument_on_session_start!
|
63
|
+
|
60
64
|
@global_context.fetch_or_activate_test_session do
|
61
65
|
tracer_span = start_datadog_tracer_span(
|
62
66
|
"test.session", build_span_options(service, Ext::AppTypes::TYPE_TEST_SESSION)
|
@@ -20,13 +20,7 @@ module Datadog
|
|
20
20
|
"type" => "span_type"
|
21
21
|
].freeze
|
22
22
|
|
23
|
-
REQUIRED_FIELDS = [
|
24
|
-
"error",
|
25
|
-
"name",
|
26
|
-
"resource",
|
27
|
-
"start",
|
28
|
-
"duration"
|
29
|
-
].freeze
|
23
|
+
REQUIRED_FIELDS = %w[error name resource start duration].freeze
|
30
24
|
|
31
25
|
attr_reader :trace, :span, :meta, :options
|
32
26
|
|
@@ -7,11 +7,11 @@ module Datadog
|
|
7
7
|
module TestVisibility
|
8
8
|
module Serializers
|
9
9
|
class Span < Base
|
10
|
-
CONTENT_FIELDS = ([
|
10
|
+
CONTENT_FIELDS = (%w[trace_id span_id parent_id] + Base::CONTENT_FIELDS).freeze
|
11
11
|
|
12
12
|
CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)
|
13
13
|
|
14
|
-
REQUIRED_FIELDS = ([
|
14
|
+
REQUIRED_FIELDS = (%w[trace_id span_id] + Base::REQUIRED_FIELDS).freeze
|
15
15
|
|
16
16
|
def content_fields
|
17
17
|
CONTENT_FIELDS
|
@@ -8,11 +8,11 @@ module Datadog
|
|
8
8
|
module TestVisibility
|
9
9
|
module Serializers
|
10
10
|
class TestModule < Base
|
11
|
-
CONTENT_FIELDS = ([
|
11
|
+
CONTENT_FIELDS = (%w[test_session_id test_module_id] + Base::CONTENT_FIELDS).freeze
|
12
12
|
|
13
13
|
CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)
|
14
14
|
|
15
|
-
REQUIRED_FIELDS = ([
|
15
|
+
REQUIRED_FIELDS = (%w[test_session_id test_module_id] + Base::REQUIRED_FIELDS).freeze
|
16
16
|
|
17
17
|
def content_fields
|
18
18
|
CONTENT_FIELDS
|
@@ -8,11 +8,11 @@ module Datadog
|
|
8
8
|
module TestVisibility
|
9
9
|
module Serializers
|
10
10
|
class TestSession < Base
|
11
|
-
CONTENT_FIELDS = ([
|
11
|
+
CONTENT_FIELDS = (%w[test_session_id] + Base::CONTENT_FIELDS).freeze
|
12
12
|
|
13
13
|
CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)
|
14
14
|
|
15
|
-
REQUIRED_FIELDS = ([
|
15
|
+
REQUIRED_FIELDS = (%w[test_session_id] + Base::REQUIRED_FIELDS).freeze
|
16
16
|
|
17
17
|
def content_fields
|
18
18
|
CONTENT_FIELDS
|
@@ -8,11 +8,11 @@ module Datadog
|
|
8
8
|
module TestVisibility
|
9
9
|
module Serializers
|
10
10
|
class TestSuite < Base
|
11
|
-
CONTENT_FIELDS = ([
|
11
|
+
CONTENT_FIELDS = (%w[test_session_id test_module_id test_suite_id] + Base::CONTENT_FIELDS).freeze
|
12
12
|
|
13
13
|
CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)
|
14
14
|
|
15
|
-
REQUIRED_FIELDS = ([
|
15
|
+
REQUIRED_FIELDS = (%w[test_session_id test_module_id test_suite_id] + Base::REQUIRED_FIELDS).freeze
|
16
16
|
|
17
17
|
def content_fields
|
18
18
|
CONTENT_FIELDS
|
@@ -8,11 +8,11 @@ module Datadog
|
|
8
8
|
module TestVisibility
|
9
9
|
module Serializers
|
10
10
|
class TestV1 < Base
|
11
|
-
CONTENT_FIELDS = ([
|
11
|
+
CONTENT_FIELDS = (%w[trace_id span_id] + Base::CONTENT_FIELDS).freeze
|
12
12
|
|
13
13
|
CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)
|
14
14
|
|
15
|
-
REQUIRED_FIELDS = ([
|
15
|
+
REQUIRED_FIELDS = (%w[trace_id span_id] + Base::REQUIRED_FIELDS).freeze
|
16
16
|
|
17
17
|
def content_fields
|
18
18
|
CONTENT_FIELDS
|
@@ -8,15 +8,15 @@ module Datadog
|
|
8
8
|
module TestVisibility
|
9
9
|
module Serializers
|
10
10
|
class TestV2 < TestV1
|
11
|
-
CONTENT_FIELDS = ([
|
11
|
+
CONTENT_FIELDS = (%w[test_session_id test_module_id test_suite_id] + TestV1::CONTENT_FIELDS).freeze
|
12
12
|
|
13
|
-
CONTENT_FIELDS_WITH_ITR_CORRELATION_ID = (CONTENT_FIELDS + [
|
13
|
+
CONTENT_FIELDS_WITH_ITR_CORRELATION_ID = (CONTENT_FIELDS + %w[itr_correlation_id]).freeze
|
14
14
|
|
15
15
|
CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)
|
16
16
|
|
17
17
|
CONTENT_MAP_SIZE_WITH_ITR_CORRELATION_ID = calculate_content_map_size(CONTENT_FIELDS_WITH_ITR_CORRELATION_ID)
|
18
18
|
|
19
|
-
REQUIRED_FIELDS = ([
|
19
|
+
REQUIRED_FIELDS = (%w[test_session_id test_module_id test_suite_id] + TestV1::REQUIRED_FIELDS).freeze
|
20
20
|
|
21
21
|
def content_fields
|
22
22
|
return CONTENT_FIELDS if itr_correlation_id.nil?
|
data/lib/datadog/ci/version.rb
CHANGED
data/lib/datadog/ci.rb
CHANGED
@@ -376,6 +376,7 @@ end
|
|
376
376
|
require_relative "ci/contrib/cucumber/integration"
|
377
377
|
require_relative "ci/contrib/rspec/integration"
|
378
378
|
require_relative "ci/contrib/minitest/integration"
|
379
|
+
require_relative "ci/contrib/selenium/integration"
|
379
380
|
|
380
381
|
# Configuration extensions
|
381
382
|
require_relative "ci/configuration/extensions"
|
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: 1.0.0
|
4
|
+
version: 1.0.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: 2024-
|
11
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: datadog
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: msgpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/datadog/ci/configuration/components.rb
|
67
67
|
- lib/datadog/ci/configuration/extensions.rb
|
68
68
|
- lib/datadog/ci/configuration/settings.rb
|
69
|
+
- lib/datadog/ci/contrib/contrib.rb
|
69
70
|
- lib/datadog/ci/contrib/cucumber/configuration/settings.rb
|
70
71
|
- lib/datadog/ci/contrib/cucumber/ext.rb
|
71
72
|
- lib/datadog/ci/contrib/cucumber/formatter.rb
|
@@ -93,6 +94,14 @@ files:
|
|
93
94
|
- lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb
|
94
95
|
- lib/datadog/ci/contrib/rspec/patcher.rb
|
95
96
|
- lib/datadog/ci/contrib/rspec/runner.rb
|
97
|
+
- lib/datadog/ci/contrib/selenium/capybara_driver.rb
|
98
|
+
- lib/datadog/ci/contrib/selenium/configuration/settings.rb
|
99
|
+
- lib/datadog/ci/contrib/selenium/driver.rb
|
100
|
+
- lib/datadog/ci/contrib/selenium/ext.rb
|
101
|
+
- lib/datadog/ci/contrib/selenium/integration.rb
|
102
|
+
- lib/datadog/ci/contrib/selenium/navigation.rb
|
103
|
+
- lib/datadog/ci/contrib/selenium/patcher.rb
|
104
|
+
- lib/datadog/ci/contrib/selenium/rum.rb
|
96
105
|
- lib/datadog/ci/contrib/settings.rb
|
97
106
|
- lib/datadog/ci/ext/app_types.rb
|
98
107
|
- lib/datadog/ci/ext/environment.rb
|
@@ -192,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
201
|
- !ruby/object:Gem::Version
|
193
202
|
version: 2.0.0
|
194
203
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
204
|
+
rubygems_version: 3.5.9
|
196
205
|
signing_key:
|
197
206
|
specification_version: 4
|
198
207
|
summary: Datadog CI visibility for your ruby application
|