Skip to content

Commit

Permalink
test auto instrumentation for minitest
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Nov 25, 2024
1 parent 7c4e422 commit c184f56
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ TEST_METADATA = {
"minitest" => {
"minitest-5" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby"
},
"minitest_auto_instrument" => {
"minitest-5" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby"
},
"activesupport" => {
"activesupport-4" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby",
"activesupport-5" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby",
Expand Down Expand Up @@ -149,6 +152,7 @@ namespace :spec do
rspec
minitest
minitest_shoulda_context
minitest_auto_instrument
activesupport
ci_queue_minitest
ci_queue_rspec
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
RSpec.describe "Minitest auto instrumentation" do
include_context "CI mode activated" do
let(:integration_name) { :no_instrument }
end

before do
require_relative "../../../../../lib/datadog/ci/auto_instrument"

require "minitest"

class SomeTest < Minitest::Test
def test_pass
assert true
end

def test_pass_other
assert true
end
end

Minitest.run([])
end

it "instruments test session" do
expect(test_session_span).not_to be_nil
expect(test_module_span).not_to be_nil

expect(first_test_suite_span).not_to be_nil
expect(first_test_suite_span.name).to eq(
"SomeTest at spec/datadog/ci/contrib/minitest_auto_instrument/instrumentation_spec.rb"
)

expect(test_spans).to have(2).items
expect(test_spans).to have_unique_tag_values_count(:test_session_id, 1)
expect(test_spans).to have_unique_tag_values_count(:test_module_id, 1)
expect(test_spans).to have_unique_tag_values_count(:test_suite_id, 1)
end
end

0 comments on commit c184f56

Please sign in to comment.