-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minitest: start test session and test module in Minitest#init_plugins…
… method as it is executed before start of parallel_executor and will propagate global context to forked rails workers
- Loading branch information
1 parent
9acd580
commit d255285
Showing
5 changed files
with
70 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "../../ext/test" | ||
require_relative "ext" | ||
|
||
module Datadog | ||
module CI | ||
module Contrib | ||
module Minitest | ||
module Runner | ||
def self.included(base) | ||
base.singleton_class.prepend(ClassMethods) | ||
end | ||
|
||
module ClassMethods | ||
def init_plugins(*) | ||
super | ||
|
||
return unless datadog_configuration[:enabled] | ||
|
||
test_session = CI.start_test_session( | ||
tags: { | ||
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK, | ||
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::Minitest::Integration.version.to_s | ||
}, | ||
service: datadog_configuration[:service_name] | ||
) | ||
CI.start_test_module(test_session.name) if test_session | ||
end | ||
|
||
private | ||
|
||
def datadog_configuration | ||
Datadog.configuration.ci[:minitest] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Datadog | ||
module CI | ||
module Contrib | ||
module Minitest | ||
module Runner | ||
def self.included: (untyped base) -> untyped | ||
|
||
class ClassMethods | ||
extend ::Minitest | ||
|
||
def init_plugins: (*untyped) -> (nil | untyped) | ||
|
||
private | ||
|
||
def datadog_configuration: () -> untyped | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |