Skip to content

Commit

Permalink
TestSession#finish
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Nov 22, 2023
1 parent 25feec6 commit bde2630
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/datadog/ci/test_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module Datadog
module CI
# Represents the whole test command process.
# Represents the whole test session process.
# This object can be shared between multiple threads.
#
# @public_api
Expand All @@ -14,6 +14,14 @@ def initialize(tracer_span)

@mutex = Mutex.new
end

# Finishes the current test session.
# @return [void]
def finish
super

CI.deactivate_test_session
end
end
end
end
17 changes: 17 additions & 0 deletions spec/datadog/ci/test_session_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

RSpec.describe Datadog::CI::TestSession do
let(:tracer_span) { instance_double(Datadog::Tracing::SpanOperation, finish: true) }

describe "#finish" do
subject(:ci_test_session) { described_class.new(tracer_span) }

before { allow(Datadog::CI).to receive(:deactivate_test_session) }

it "deactivates the test" do
ci_test_session.finish

expect(Datadog::CI).to have_received(:deactivate_test_session)
end
end
end

0 comments on commit bde2630

Please sign in to comment.