Skip to content

Commit

Permalink
fix sinatra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brettlangdon committed Feb 26, 2019
1 parent ad0e209 commit c88f3f8
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions spec/ddtrace/contrib/sinatra/tracer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,7 @@
end
end

context 'with distributed tracing' do
let(:options) { super().merge(distributed_tracing: true) }

context 'with distributed tracing default' do
context 'and a simple request is made' do
include_context 'app with simple route'

Expand Down Expand Up @@ -324,6 +322,36 @@
end
end

context 'with distributed tracing disabled' do
let(:options) { super().merge(distributed_tracing: false) }

context 'and a simple request is made' do
include_context 'app with simple route'

subject(:response) { get '/', query_string, headers }
let(:query_string) { {} }
let(:headers) { {} }

context 'without distributed tracing headers' do
let(:headers) do
{
'HTTP_X_DATADOG_TRACE_ID' => '1',
'HTTP_X_DATADOG_PARENT_ID' => '2',
'HTTP_X_DATADOG_SAMPLING_PRIORITY' => Datadog::Ext::Priority::USER_KEEP.to_s
}
end

it do
is_expected.to be_ok
expect(spans).to have(1).items
expect(span.trace_id).to_not eq(1)
expect(span.parent_id).to_not eq(2)
expect(span.get_metric(Datadog::Ext::DistributedTracing::SAMPLING_PRIORITY_KEY)).to_not eq(2.0)
end
end
end
end

context 'with header tags' do
let(:options) { super().merge(headers: { request: request_headers, response: response_headers }) }
let(:request_headers) { [] }
Expand Down

0 comments on commit c88f3f8

Please sign in to comment.