-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test auto instrumentation for minitest
- Loading branch information
1 parent
7c4e422
commit c184f56
Showing
2 changed files
with
42 additions
and
0 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
38 changes: 38 additions & 0 deletions
38
spec/datadog/ci/contrib/minitest_auto_instrument/instrumentation_spec.rb
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,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 |