-
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.
- Loading branch information
1 parent
a1d2e4b
commit 750b30a
Showing
17 changed files
with
385 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module CI | ||
module Context | ||
# This context is shared between threads and represents the current test session. | ||
class Global | ||
def initialize | ||
@mutex = Mutex.new | ||
@test_session = nil | ||
end | ||
|
||
def active_test_session | ||
@test_session | ||
end | ||
|
||
def activate_test_session!(test_session) | ||
@mutex.synchronize do | ||
raise "Nested test sessions are not supported. Currently active test session: #{@test_session}" unless @test_session.nil? | ||
|
||
@test_session = test_session | ||
end | ||
end | ||
|
||
def deactivate_test_session! | ||
@mutex.synchronize { @test_session = nil } | ||
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
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,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "span" | ||
|
||
module Datadog | ||
module CI | ||
# Represents the whole test session process. | ||
# This object can be shared between multiple threads. | ||
# | ||
# @public_api | ||
class TestSession < Span | ||
def initialize(tracer_span) | ||
super | ||
|
||
@mutex = Mutex.new | ||
end | ||
|
||
# Finishes the current test session. | ||
# @return [void] | ||
def finish | ||
super | ||
|
||
CI.deactivate_test_session | ||
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 |
---|---|---|
|
@@ -37,7 +37,7 @@ def content_map_size | |
end | ||
|
||
def type | ||
"test" | ||
Ext::AppTypes::TYPE_TEST | ||
end | ||
|
||
def name | ||
|
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 Context | ||
class Global | ||
@mutex: Thread::Mutex | ||
|
||
@test_session: Datadog::CI::TestSession? | ||
|
||
def initialize: () -> void | ||
|
||
def active_test_session: () -> Datadog::CI::TestSession? | ||
|
||
def activate_test_session!: (Datadog::CI::TestSession test_session) -> void | ||
|
||
def deactivate_test_session!: () -> void | ||
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
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,7 @@ | ||
module Datadog | ||
module CI | ||
class TestSession < Span | ||
@mutex: Thread::Mutex | ||
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
Oops, something went wrong.