Skip to content

Commit

Permalink
Span#to_s method
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Nov 7, 2023
1 parent 8059258 commit fea20a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/datadog/ci/span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def set_environment_runtime_tags
def set_default_tags
tracer_span.set_tag(Ext::Test::TAG_SPAN_KIND, Ext::AppTypes::TYPE_TEST)
end

def to_s
"#{self.class}(name:#{name},tracer_span:#{@tracer_span})"
end
end
end
end
10 changes: 8 additions & 2 deletions spec/datadog/ci/context/local_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe Datadog::CI::Context::Local do
subject { described_class.new }

let(:tracer_span) { double(Datadog::Tracing::SpanOperation) }
let(:tracer_span) { double(Datadog::Tracing::SpanOperation, get_tag: "my test") }
let(:ci_test) { Datadog::CI::Test.new(tracer_span) }
let(:ci_test2) { Datadog::CI::Test.new(tracer_span) }

Expand All @@ -14,7 +14,13 @@ def fiber_active_tests
it "raises an error" do
subject.activate_test!(Datadog::CI::Test.new(tracer_span))

expect { subject.activate_test!(ci_test) }.to raise_error(RuntimeError, /Nested tests are not supported/)
expect { subject.activate_test!(ci_test) }.to(
raise_error(
RuntimeError,
"Nested tests are not supported. Currently active test: " \
"Datadog::CI::Test(name:my test,tracer_span:#[Double Datadog::Tracing::SpanOperation])"
)
)
end
end

Expand Down

0 comments on commit fea20a4

Please sign in to comment.