datadog-ci 1.8.1 → 1.9.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 +10 -2
- data/README.md +6 -8
- data/exe/ddcirb +3 -1
- data/lib/datadog/ci/auto_instrument.rb +8 -0
- data/lib/datadog/ci/cli/cli.rb +5 -1
- data/lib/datadog/ci/cli/command/exec.rb +29 -0
- data/lib/datadog/ci/configuration/settings.rb +3 -21
- data/lib/datadog/ci/contrib/ciqueue/integration.rb +34 -0
- data/lib/datadog/ci/contrib/ciqueue/patcher.rb +23 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +10 -5
- data/lib/datadog/ci/contrib/cucumber/integration.rb +5 -14
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +2 -6
- data/lib/datadog/ci/contrib/instrumentation.rb +173 -0
- data/lib/datadog/ci/contrib/integration.rb +101 -117
- data/lib/datadog/ci/contrib/knapsack/extension.rb +27 -0
- data/lib/datadog/ci/contrib/knapsack/integration.rb +36 -0
- data/lib/datadog/ci/contrib/knapsack/patcher.rb +29 -0
- data/lib/datadog/ci/contrib/knapsack/runner.rb +66 -0
- data/lib/datadog/ci/contrib/minitest/integration.rb +6 -14
- data/lib/datadog/ci/contrib/minitest/patcher.rb +1 -5
- data/lib/datadog/ci/contrib/minitest/runner.rb +6 -1
- data/lib/datadog/ci/contrib/minitest/test.rb +6 -1
- data/lib/datadog/ci/contrib/patcher.rb +62 -0
- data/lib/datadog/ci/contrib/rspec/example.rb +6 -1
- data/lib/datadog/ci/contrib/rspec/integration.rb +10 -13
- data/lib/datadog/ci/contrib/rspec/patcher.rb +2 -33
- data/lib/datadog/ci/contrib/rspec/runner.rb +6 -1
- data/lib/datadog/ci/contrib/selenium/capybara_driver.rb +1 -1
- data/lib/datadog/ci/contrib/selenium/driver.rb +1 -1
- data/lib/datadog/ci/contrib/selenium/integration.rb +6 -10
- data/lib/datadog/ci/contrib/selenium/navigation.rb +6 -2
- data/lib/datadog/ci/contrib/selenium/patcher.rb +2 -6
- data/lib/datadog/ci/contrib/selenium/rum.rb +0 -2
- data/lib/datadog/ci/contrib/simplecov/integration.rb +6 -10
- data/lib/datadog/ci/contrib/simplecov/patcher.rb +2 -6
- data/lib/datadog/ci/test_retries/strategy/retry_new.rb +1 -1
- data/lib/datadog/ci/test_visibility/component.rb +2 -2
- data/lib/datadog/ci/test_visibility/telemetry.rb +2 -1
- data/lib/datadog/ci/version.rb +2 -2
- data/lib/datadog/ci.rb +9 -1
- metadata +13 -7
- data/lib/datadog/ci/contrib/contrib.rb +0 -31
- data/lib/datadog/ci/contrib/rspec/knapsack_pro/extension.rb +0 -29
- data/lib/datadog/ci/contrib/rspec/knapsack_pro/patcher.rb +0 -26
- data/lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb +0 -62
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../patcher"
|
4
4
|
|
5
5
|
require_relative "example"
|
6
6
|
require_relative "example_group"
|
@@ -12,46 +12,15 @@ module Datadog
|
|
12
12
|
module RSpec
|
13
13
|
# Patcher enables patching of 'rspec' module.
|
14
14
|
module Patcher
|
15
|
-
include Datadog::
|
15
|
+
include Datadog::CI::Contrib::Patcher
|
16
16
|
|
17
17
|
module_function
|
18
18
|
|
19
|
-
def target_version
|
20
|
-
Integration.version
|
21
|
-
end
|
22
|
-
|
23
19
|
def patch
|
24
|
-
# ci-queue test runner instrumentation
|
25
|
-
# https://github.com/Shopify/ci-queue
|
26
|
-
if ci_queue?
|
27
|
-
::RSpec::Queue::Runner.include(Runner)
|
28
|
-
end
|
29
|
-
|
30
|
-
if knapsack_pro?
|
31
|
-
# Knapsack Pro test runner instrumentation
|
32
|
-
# https://github.com/KnapsackPro/knapsack_pro-ruby
|
33
|
-
require_relative "knapsack_pro/patcher"
|
34
|
-
Datadog::CI::Contrib::RSpec::KnapsackPro::Patcher.patch
|
35
|
-
end
|
36
|
-
|
37
|
-
# default rspec test runner instrumentation
|
38
20
|
::RSpec::Core::Runner.include(Runner)
|
39
|
-
|
40
21
|
::RSpec::Core::Example.include(Example)
|
41
22
|
::RSpec::Core::ExampleGroup.include(ExampleGroup)
|
42
23
|
end
|
43
|
-
|
44
|
-
def ci_queue?
|
45
|
-
!!defined?(::RSpec::Queue::Runner)
|
46
|
-
end
|
47
|
-
|
48
|
-
def knapsack_pro?
|
49
|
-
knapsack_version = Gem.loaded_specs["knapsack_pro"]&.version
|
50
|
-
|
51
|
-
# additional instrumentation is needed for KnapsackPro version 7 and later
|
52
|
-
!!defined?(::KnapsackPro) &&
|
53
|
-
!knapsack_version.nil? && knapsack_version >= Gem::Version.new("7")
|
54
|
-
end
|
55
24
|
end
|
56
25
|
end
|
57
26
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../../ext/test"
|
4
|
+
require_relative "../instrumentation"
|
4
5
|
require_relative "ext"
|
5
6
|
|
6
7
|
module Datadog
|
@@ -21,7 +22,7 @@ module Datadog
|
|
21
22
|
test_session = test_visibility_component.start_test_session(
|
22
23
|
tags: {
|
23
24
|
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
|
24
|
-
CI::Ext::Test::TAG_FRAMEWORK_VERSION =>
|
25
|
+
CI::Ext::Test::TAG_FRAMEWORK_VERSION => datadog_integration.version.to_s
|
25
26
|
},
|
26
27
|
service: datadog_configuration[:service_name],
|
27
28
|
total_tests_count: ::RSpec.world.example_count
|
@@ -47,6 +48,10 @@ module Datadog
|
|
47
48
|
|
48
49
|
private
|
49
50
|
|
51
|
+
def datadog_integration
|
52
|
+
CI::Contrib::Instrumentation.fetch_integration(:rspec)
|
53
|
+
end
|
54
|
+
|
50
55
|
def datadog_configuration
|
51
56
|
Datadog.configuration.ci[:rspec]
|
52
57
|
end
|
@@ -9,28 +9,24 @@ module Datadog
|
|
9
9
|
module Contrib
|
10
10
|
module Selenium
|
11
11
|
# Description of Selenium integration
|
12
|
-
class Integration
|
13
|
-
include Datadog::CI::Contrib::Integration
|
14
|
-
|
12
|
+
class Integration < Contrib::Integration
|
15
13
|
MINIMUM_VERSION = Gem::Version.new("4.0.0")
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
def self.version
|
15
|
+
def version
|
20
16
|
Gem.loaded_specs["selenium-webdriver"]&.version
|
21
17
|
end
|
22
18
|
|
23
|
-
def
|
19
|
+
def loaded?
|
24
20
|
!defined?(::Selenium).nil? && !defined?(::Selenium::WebDriver).nil? &&
|
25
21
|
!defined?(::Selenium::WebDriver::Driver).nil?
|
26
22
|
end
|
27
23
|
|
28
|
-
def
|
24
|
+
def compatible?
|
29
25
|
super && version >= MINIMUM_VERSION
|
30
26
|
end
|
31
27
|
|
32
|
-
# additional instrumentations for test
|
33
|
-
def
|
28
|
+
# additional instrumentations for test libraries are late instrumented on test session start
|
29
|
+
def late_instrument?
|
34
30
|
true
|
35
31
|
end
|
36
32
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../patcher"
|
4
4
|
|
5
5
|
require_relative "ext"
|
6
6
|
require_relative "../../ext/test"
|
@@ -43,7 +43,7 @@ module Datadog
|
|
43
43
|
active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER, "selenium")
|
44
44
|
active_test.set_tag(
|
45
45
|
CI::Ext::Test::TAG_BROWSER_DRIVER_VERSION,
|
46
|
-
|
46
|
+
datadog_integration.version
|
47
47
|
)
|
48
48
|
active_test.set_tag(
|
49
49
|
CI::Ext::Test::TAG_BROWSER_NAME,
|
@@ -63,6 +63,10 @@ module Datadog
|
|
63
63
|
|
64
64
|
private
|
65
65
|
|
66
|
+
def datadog_integration
|
67
|
+
CI::Contrib::Instrumentation.fetch_integration(:selenium)
|
68
|
+
end
|
69
|
+
|
66
70
|
def datadog_configuration
|
67
71
|
Datadog.configuration.ci[:selenium]
|
68
72
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../patcher"
|
4
4
|
|
5
5
|
require_relative "capybara_driver"
|
6
6
|
require_relative "driver"
|
@@ -12,14 +12,10 @@ module Datadog
|
|
12
12
|
module Selenium
|
13
13
|
# Patcher enables patching of 'Selenium::WebDriver' module.
|
14
14
|
module Patcher
|
15
|
-
include Datadog::
|
15
|
+
include Datadog::CI::Contrib::Patcher
|
16
16
|
|
17
17
|
module_function
|
18
18
|
|
19
|
-
def target_version
|
20
|
-
Integration.version
|
21
|
-
end
|
22
|
-
|
23
19
|
def patch
|
24
20
|
::Selenium::WebDriver::Driver.include(Driver)
|
25
21
|
::Selenium::WebDriver::Navigation.include(Navigation)
|
@@ -9,27 +9,23 @@ module Datadog
|
|
9
9
|
module Contrib
|
10
10
|
module Simplecov
|
11
11
|
# Description of Simplecov integration
|
12
|
-
class Integration
|
13
|
-
include Datadog::CI::Contrib::Integration
|
14
|
-
|
12
|
+
class Integration < Contrib::Integration
|
15
13
|
MINIMUM_VERSION = Gem::Version.new("0.18.0")
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
def self.version
|
15
|
+
def version
|
20
16
|
Gem.loaded_specs["simplecov"]&.version
|
21
17
|
end
|
22
18
|
|
23
|
-
def
|
19
|
+
def loaded?
|
24
20
|
!defined?(::SimpleCov).nil?
|
25
21
|
end
|
26
22
|
|
27
|
-
def
|
23
|
+
def compatible?
|
28
24
|
super && version >= MINIMUM_VERSION
|
29
25
|
end
|
30
26
|
|
31
|
-
# additional instrumentations for test
|
32
|
-
def
|
27
|
+
# additional instrumentations for test libraries are late instrumented on test session start
|
28
|
+
def late_instrument?
|
33
29
|
true
|
34
30
|
end
|
35
31
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../patcher"
|
4
4
|
|
5
5
|
require_relative "result_extractor"
|
6
6
|
|
@@ -10,14 +10,10 @@ module Datadog
|
|
10
10
|
module Simplecov
|
11
11
|
# Patcher enables patching of 'SimpleCov' module.
|
12
12
|
module Patcher
|
13
|
-
include Datadog::
|
13
|
+
include Datadog::CI::Contrib::Patcher
|
14
14
|
|
15
15
|
module_function
|
16
16
|
|
17
|
-
def target_version
|
18
|
-
Integration.version
|
19
|
-
end
|
20
|
-
|
21
17
|
def patch
|
22
18
|
::SimpleCov.include(ResultExtractor)
|
23
19
|
end
|
@@ -101,7 +101,7 @@ module Datadog
|
|
101
101
|
end
|
102
102
|
@total_limit = (tests_count * percentage_limit / 100.0).ceil
|
103
103
|
Datadog.logger.debug do
|
104
|
-
"Retry new tests total limit is [#{@total_limit}] (#{percentage_limit}%
|
104
|
+
"Retry new tests total limit is [#{@total_limit}] (#{percentage_limit}% of #{tests_count})"
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -7,7 +7,7 @@ require_relative "telemetry"
|
|
7
7
|
require_relative "total_coverage"
|
8
8
|
|
9
9
|
require_relative "../codeowners/parser"
|
10
|
-
require_relative "../contrib/
|
10
|
+
require_relative "../contrib/instrumentation"
|
11
11
|
require_relative "../ext/test"
|
12
12
|
require_relative "../git/local_repository"
|
13
13
|
|
@@ -149,7 +149,7 @@ module Datadog
|
|
149
149
|
git_tree_upload_worker.perform(test_session.git_repository_url)
|
150
150
|
|
151
151
|
# finds and instruments additional test libraries that we support (ex: selenium-webdriver)
|
152
|
-
Contrib.
|
152
|
+
Contrib::Instrumentation.instrument_on_session_start
|
153
153
|
|
154
154
|
# sends internal telemetry events
|
155
155
|
Telemetry.test_session_started(test_session)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative "../contrib/instrumentation"
|
3
4
|
require_relative "../ext/app_types"
|
4
5
|
require_relative "../ext/environment"
|
5
6
|
require_relative "../ext/telemetry"
|
@@ -33,7 +34,7 @@ module Datadog
|
|
33
34
|
Ext::Telemetry::METRIC_TEST_SESSION,
|
34
35
|
1,
|
35
36
|
{
|
36
|
-
Ext::Telemetry::TAG_AUTO_INJECTED =>
|
37
|
+
Ext::Telemetry::TAG_AUTO_INJECTED => Contrib::Instrumentation.auto_instrumented?.to_s,
|
37
38
|
Ext::Telemetry::TAG_PROVIDER => test_session.ci_provider || Ext::Telemetry::Provider::UNSUPPORTED
|
38
39
|
}
|
39
40
|
)
|
data/lib/datadog/ci/version.rb
CHANGED
data/lib/datadog/ci.rb
CHANGED
@@ -406,9 +406,17 @@ module Datadog
|
|
406
406
|
end
|
407
407
|
|
408
408
|
# Integrations
|
409
|
+
|
410
|
+
# Test frameworks (manual instrumentation)
|
409
411
|
require_relative "ci/contrib/cucumber/integration"
|
410
|
-
require_relative "ci/contrib/rspec/integration"
|
411
412
|
require_relative "ci/contrib/minitest/integration"
|
413
|
+
require_relative "ci/contrib/rspec/integration"
|
414
|
+
|
415
|
+
# Test runners (instrumented automatically when corresponding frameworks are instrumented)
|
416
|
+
require_relative "ci/contrib/knapsack/integration"
|
417
|
+
require_relative "ci/contrib/ciqueue/integration"
|
418
|
+
|
419
|
+
# Additional test libraries (auto instrumented later on test session start)
|
412
420
|
require_relative "ci/contrib/selenium/integration"
|
413
421
|
require_relative "ci/contrib/simplecov/integration"
|
414
422
|
|
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.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: datadog
|
@@ -61,8 +61,10 @@ files:
|
|
61
61
|
- ext/datadog_cov/datadog_cov.c
|
62
62
|
- ext/datadog_cov/extconf.rb
|
63
63
|
- lib/datadog/ci.rb
|
64
|
+
- lib/datadog/ci/auto_instrument.rb
|
64
65
|
- lib/datadog/ci/cli/cli.rb
|
65
66
|
- lib/datadog/ci/cli/command/base.rb
|
67
|
+
- lib/datadog/ci/cli/command/exec.rb
|
66
68
|
- lib/datadog/ci/cli/command/skippable_tests_percentage.rb
|
67
69
|
- lib/datadog/ci/cli/command/skippable_tests_percentage_estimate.rb
|
68
70
|
- lib/datadog/ci/codeowners/matcher.rb
|
@@ -72,7 +74,8 @@ files:
|
|
72
74
|
- lib/datadog/ci/configuration/components.rb
|
73
75
|
- lib/datadog/ci/configuration/extensions.rb
|
74
76
|
- lib/datadog/ci/configuration/settings.rb
|
75
|
-
- lib/datadog/ci/contrib/
|
77
|
+
- lib/datadog/ci/contrib/ciqueue/integration.rb
|
78
|
+
- lib/datadog/ci/contrib/ciqueue/patcher.rb
|
76
79
|
- lib/datadog/ci/contrib/cucumber/configuration/settings.rb
|
77
80
|
- lib/datadog/ci/contrib/cucumber/ext.rb
|
78
81
|
- lib/datadog/ci/contrib/cucumber/filter.rb
|
@@ -80,7 +83,12 @@ files:
|
|
80
83
|
- lib/datadog/ci/contrib/cucumber/instrumentation.rb
|
81
84
|
- lib/datadog/ci/contrib/cucumber/integration.rb
|
82
85
|
- lib/datadog/ci/contrib/cucumber/patcher.rb
|
86
|
+
- lib/datadog/ci/contrib/instrumentation.rb
|
83
87
|
- lib/datadog/ci/contrib/integration.rb
|
88
|
+
- lib/datadog/ci/contrib/knapsack/extension.rb
|
89
|
+
- lib/datadog/ci/contrib/knapsack/integration.rb
|
90
|
+
- lib/datadog/ci/contrib/knapsack/patcher.rb
|
91
|
+
- lib/datadog/ci/contrib/knapsack/runner.rb
|
84
92
|
- lib/datadog/ci/contrib/minitest/configuration/settings.rb
|
85
93
|
- lib/datadog/ci/contrib/minitest/ext.rb
|
86
94
|
- lib/datadog/ci/contrib/minitest/helpers.rb
|
@@ -90,14 +98,12 @@ files:
|
|
90
98
|
- lib/datadog/ci/contrib/minitest/runnable.rb
|
91
99
|
- lib/datadog/ci/contrib/minitest/runner.rb
|
92
100
|
- lib/datadog/ci/contrib/minitest/test.rb
|
101
|
+
- lib/datadog/ci/contrib/patcher.rb
|
93
102
|
- lib/datadog/ci/contrib/rspec/configuration/settings.rb
|
94
103
|
- lib/datadog/ci/contrib/rspec/example.rb
|
95
104
|
- lib/datadog/ci/contrib/rspec/example_group.rb
|
96
105
|
- lib/datadog/ci/contrib/rspec/ext.rb
|
97
106
|
- lib/datadog/ci/contrib/rspec/integration.rb
|
98
|
-
- lib/datadog/ci/contrib/rspec/knapsack_pro/extension.rb
|
99
|
-
- lib/datadog/ci/contrib/rspec/knapsack_pro/patcher.rb
|
100
|
-
- lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb
|
101
107
|
- lib/datadog/ci/contrib/rspec/patcher.rb
|
102
108
|
- lib/datadog/ci/contrib/rspec/runner.rb
|
103
109
|
- lib/datadog/ci/contrib/selenium/capybara_driver.rb
|
@@ -241,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
247
|
- !ruby/object:Gem::Version
|
242
248
|
version: 2.0.0
|
243
249
|
requirements: []
|
244
|
-
rubygems_version: 3.5.
|
250
|
+
rubygems_version: 3.5.22
|
245
251
|
signing_key:
|
246
252
|
specification_version: 4
|
247
253
|
summary: Datadog CI visibility for your ruby application
|
@@ -1,31 +0,0 @@
|
|
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
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "knapsack_pro/extensions/rspec_extension"
|
4
|
-
|
5
|
-
require_relative "runner"
|
6
|
-
|
7
|
-
module Datadog
|
8
|
-
module CI
|
9
|
-
module Contrib
|
10
|
-
module RSpec
|
11
|
-
module KnapsackPro
|
12
|
-
module Extension
|
13
|
-
def self.included(base)
|
14
|
-
base.singleton_class.prepend(ClassMethods)
|
15
|
-
end
|
16
|
-
|
17
|
-
module ClassMethods
|
18
|
-
def setup!
|
19
|
-
super
|
20
|
-
|
21
|
-
::RSpec::Core::Runner.include(Datadog::CI::Contrib::RSpec::KnapsackPro::Runner)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module CI
|
5
|
-
module Contrib
|
6
|
-
module RSpec
|
7
|
-
module KnapsackPro
|
8
|
-
module Patcher
|
9
|
-
def self.patch
|
10
|
-
if defined?(::KnapsackPro::Extensions::RSpecExtension::Runner) &&
|
11
|
-
::RSpec::Core::Runner.ancestors.include?(::KnapsackPro::Extensions::RSpecExtension::Runner)
|
12
|
-
# knapsack already patched rspec runner
|
13
|
-
require_relative "runner"
|
14
|
-
::RSpec::Core::Runner.include(KnapsackPro::Runner)
|
15
|
-
else
|
16
|
-
# knapsack didn't patch rspec runner yet
|
17
|
-
require_relative "extension"
|
18
|
-
::KnapsackPro::Extensions::RSpecExtension.include(KnapsackPro::Extension)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "../../../ext/test"
|
4
|
-
require_relative "../ext"
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module CI
|
8
|
-
module Contrib
|
9
|
-
module RSpec
|
10
|
-
module KnapsackPro
|
11
|
-
module Runner
|
12
|
-
def self.included(base)
|
13
|
-
base.prepend(InstanceMethods)
|
14
|
-
end
|
15
|
-
|
16
|
-
module InstanceMethods
|
17
|
-
def knapsack__run_specs(*args)
|
18
|
-
return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
|
19
|
-
return super unless datadog_configuration[:enabled]
|
20
|
-
|
21
|
-
test_session = test_visibility_component.start_test_session(
|
22
|
-
tags: {
|
23
|
-
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
|
24
|
-
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::RSpec::Integration.version.to_s
|
25
|
-
},
|
26
|
-
service: datadog_configuration[:service_name]
|
27
|
-
)
|
28
|
-
|
29
|
-
test_module = test_visibility_component.start_test_module(Ext::FRAMEWORK)
|
30
|
-
|
31
|
-
result = super
|
32
|
-
return result unless test_module && test_session
|
33
|
-
|
34
|
-
if result != 0
|
35
|
-
test_module.failed!
|
36
|
-
test_session.failed!
|
37
|
-
else
|
38
|
-
test_module.passed!
|
39
|
-
test_session.passed!
|
40
|
-
end
|
41
|
-
test_module.finish
|
42
|
-
test_session.finish
|
43
|
-
|
44
|
-
result
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def datadog_configuration
|
50
|
-
Datadog.configuration.ci[:rspec]
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_visibility_component
|
54
|
-
Datadog.send(:components).test_visibility
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|