Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On RSpec integration, change suite name to example group file path (i.e. "fix" shared_examples suite names) #1816

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/datadog/ci/contrib/rspec/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run(example_group_instance, reporter)
framework: Ext::FRAMEWORK,
framework_version: CI::Contrib::RSpec::Integration.version.to_s,
test_name: test_name,
test_suite: file_path,
test_suite: metadata[:example_group][:file_path],
test_type: Ext::TEST_TYPE
}
) do |span|
Expand Down
11 changes: 11 additions & 0 deletions spec/datadog/ci/contrib/rspec/instrumentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ def with_new_rspec_environment
expect(span.get_tag(Datadog::CI::Ext::Test::TAG_STATUS)).to eq(Datadog::CI::Ext::Test::Status::PASS)
end

it 'creates correct span on shared examples' do
spec = with_new_rspec_environment do
require 'spec/datadog/ci/contrib/rspec/some_shared_examples'
spec = RSpec.describe 'some test' do
include_examples 'Testing shared examples'
end.tap(&:run)
end

expect(span.get_tag(Datadog::CI::Ext::Test::TAG_SUITE)).to eq(spec.file_path)
end

it 'creates spans for several examples' do
num_examples = 20
with_new_rspec_environment do
Expand Down
5 changes: 5 additions & 0 deletions spec/datadog/ci/contrib/rspec/some_shared_examples.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# typed: ignore

RSpec.shared_examples 'Testing shared examples' do
it { expect(1 + 1).to eq(2) }
end