-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
instrument knapsack_pro runner in queue mode
- Loading branch information
1 parent
320d595
commit 264765c
Showing
8 changed files
with
164 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ target :lib do | |
library "cucumber" | ||
library "msgpack" | ||
library "ci_queue" | ||
library "knapsack_pro" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require "knapsack_pro/extensions/rspec_extension" | ||
|
||
require_relative "runner" | ||
|
||
module Datadog | ||
module CI | ||
module Contrib | ||
module RSpec | ||
# Instrument RSpec::Core::Example | ||
module KnapsackPro | ||
module Extension | ||
def self.included(base) | ||
base.singleton_class.prepend(ClassMethods) | ||
end | ||
|
||
module ClassMethods | ||
def setup! | ||
super | ||
|
||
::RSpec::Core::Runner.include(Datadog::CI::Contrib::RSpec::KnapsackPro::Runner) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "../../../ext/test" | ||
require_relative "../ext" | ||
|
||
module Datadog | ||
module CI | ||
module Contrib | ||
module RSpec | ||
module KnapsackPro | ||
module Runner | ||
def self.included(base) | ||
base.prepend(InstanceMethods) | ||
end | ||
|
||
module InstanceMethods | ||
def knapsack__run_specs(*) | ||
return super 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::RSpec::Integration.version.to_s | ||
}, | ||
service: datadog_configuration[:service_name] | ||
) | ||
|
||
test_module = CI.start_test_module(Ext::FRAMEWORK) | ||
|
||
result = super | ||
return result unless test_module && test_session | ||
|
||
if result != 0 | ||
test_module.failed! | ||
test_session.failed! | ||
else | ||
test_module.passed! | ||
test_session.passed! | ||
end | ||
test_module.finish | ||
test_session.finish | ||
|
||
result | ||
end | ||
|
||
private | ||
|
||
def datadog_configuration | ||
Datadog.configuration.ci[:rspec] | ||
end | ||
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,19 @@ | ||
module Datadog | ||
module CI | ||
module Contrib | ||
module RSpec | ||
module KnapsackPro | ||
module Extension | ||
def self.included: (untyped base) -> untyped | ||
|
||
module ClassMethods | ||
include ::KnapsackPro::Extensions::RSpecExtension | ||
|
||
def setup!: () -> void | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Datadog | ||
module CI | ||
module Contrib | ||
module RSpec | ||
module KnapsackPro | ||
module Runner | ||
def self.included: (untyped base) -> untyped | ||
|
||
module InstanceMethods | ||
include ::KnapsackPro::Runners::Queue::RSpecRunner | ||
|
||
def knapsack__run_specs: (untyped args) -> untyped | ||
|
||
private | ||
|
||
def datadog_configuration: () -> untyped | ||
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,17 @@ | ||
module KnapsackPro | ||
module Runners | ||
module Queue | ||
module RSpecRunner | ||
def knapsack__run_specs: (untyped arg) -> untyped | ||
end | ||
end | ||
end | ||
end | ||
|
||
module KnapsackPro | ||
module Extensions | ||
module RSpecExtension | ||
def setup!: () -> void | ||
end | ||
end | ||
end |