Skip to content

Commit

Permalink
source file integration for minitest
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jan 4, 2024
1 parent 4b2c122 commit e47382e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/datadog/ci/contrib/minitest/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ def before_setup
CI.start_test_suite(test_suite_name)
end

source_file, line_number = method(name).source_location

CI.start_test(
test_name,
test_suite_name,
tags: {
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::Minitest::Integration.version.to_s,
CI::Ext::Test::TAG_TYPE => CI::Ext::Test::TEST_TYPE
CI::Ext::Test::TAG_TYPE => CI::Ext::Test::TEST_TYPE,
CI::Ext::Test::TAG_SOURCE_FILE => Utils::Git.relative_to_root(source_file),
CI::Ext::Test::TAG_SOURCE_START => line_number.to_s
},
service: datadog_configuration[:service_name]
)
Expand Down
4 changes: 4 additions & 0 deletions spec/datadog/ci/contrib/minitest/instrumentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def test_foo
Datadog::CI::Contrib::Minitest::Integration.version.to_s
)
expect(span.get_tag(Datadog::CI::Ext::Test::TAG_STATUS)).to eq(Datadog::CI::Ext::Test::Status::PASS)
expect(span.get_tag(Datadog::CI::Ext::Test::TAG_SOURCE_FILE)).to eq(
"spec/datadog/ci/contrib/minitest/instrumentation_spec.rb"
)
expect(span.get_tag(Datadog::CI::Ext::Test::TAG_SOURCE_START)).to eq("29")
end

it "creates spans for several tests" do
Expand Down

0 comments on commit e47382e

Please sign in to comment.