Skip to content

Commit

Permalink
Add quantize: { base: :show } test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lloeki committed Oct 12, 2022
1 parent 1bafb17 commit 450c7cd
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion spec/datadog/tracing/contrib/rack/integration_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
end
end

context 'with REQUEST_URI' do
context 'with REQUEST_URI being a path' do
subject(:response) { get '/success?foo=bar', {}, 'REQUEST_URI' => '/success?foo=bar' }

context 'and default quantization' do
Expand Down Expand Up @@ -186,6 +186,21 @@
expect(span).to be_root_span
end
end

context 'and quantization activated for base' do
let(:rack_options) { { quantize: { base: :show } } }

it_behaves_like 'a rack GET 200 span'

it do
# Since REQUEST_URI is set (usually provided by WEBrick/Puma)
# it uses REQUEST_URI, which has query string parameters.
# The query string will not be quantized, per the option.
expect(span.get_tag('http.url')).to eq('http://example.org/success?foo')
expect(span.get_tag('http.base_url')).to be_nil
expect(span).to be_root_span
end
end
end

context 'with REQUEST_URI containing base URI' do
Expand Down Expand Up @@ -220,6 +235,21 @@
expect(span).to be_root_span
end
end

context 'and quantization activated for base' do
let(:rack_options) { { quantize: { base: :show } } }

it_behaves_like 'a rack GET 200 span'

it do
# Since REQUEST_URI is set (usually provided by WEBrick/Puma)
# it uses REQUEST_URI, which has query string parameters.
# The query string will not be quantized, per the option.
expect(span.get_tag('http.url')).to eq('http://example.org/success?foo')
expect(span.get_tag('http.base_url')).to be_nil
expect(span).to be_root_span
end
end
end

context 'with sub-route' do
Expand Down

0 comments on commit 450c7cd

Please sign in to comment.