-
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 1ab459c
Showing
9 changed files
with
95 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module CI | ||
module Context | ||
class Global | ||
def initialize | ||
@mutex = Mutex.new | ||
@test_session = nil | ||
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!(test_session) | ||
@mutex.synchronize do | ||
return if @test_session.nil? | ||
|
||
if @test_session == test_session | ||
@test_session = nil | ||
else | ||
raise "Trying to deactivate test session #{test_session}, but currently active test session is #{@test_session}" | ||
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
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 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "span" | ||
|
||
module Datadog | ||
module CI | ||
# Represents the whole test command process. | ||
# This object can be shared between multiple threads. | ||
# | ||
# @public_api | ||
class TestSession < Span | ||
def initialize(tracer_span) | ||
super | ||
|
||
@mutex = Mutex.new | ||
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,6 @@ | ||
module Datadog | ||
module CI | ||
class TestSession < Span | ||
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