Skip to content

Commit

Permalink
Test query string quantization for PATH_INFO
Browse files Browse the repository at this point in the history
Note: there seems to be leakage between spec cases, which made this test
case flaky, with quantization option being set to show foo (example
seed: 63620). The test case was previously unaffected by this leakage
because it could not handle query strings.
  • Loading branch information
lloeki committed Sep 13, 2022
1 parent 3b2c316 commit f439d0e
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions spec/datadog/tracing/contrib/rack/integration_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,28 @@
context 'with query string parameters' do
let(:route) { '/success?foo=bar' }

it_behaves_like 'a rack GET 200 span'
context 'and default quantization' do
let(:rack_options) { super().merge(quantize: {}) }

it do
# Since REQUEST_URI isn't available in Rack::Test by default (comes from WEBrick/Puma)
# it reverts to PATH_INFO, which doesn't have query string parameters.
expect(span.get_tag('http.url')).to eq('/success?foo')
expect(span.get_tag('http.base_url')).to eq('http://example.org')
expect(span).to be_root_span
it_behaves_like 'a rack GET 200 span'

it do
expect(span.get_tag('http.url')).to eq('/success?foo')
expect(span.get_tag('http.base_url')).to eq('http://example.org')
expect(span).to be_root_span
end
end

context 'and quantization activated for the query' do
let(:rack_options) { super().merge(quantize: { query: { show: ['foo'] } }) }

it_behaves_like 'a rack GET 200 span'

it do
expect(span.get_tag('http.url')).to eq('/success?foo=bar')
expect(span.get_tag('http.base_url')).to eq('http://example.org')
expect(span).to be_root_span
end
end
end

Expand Down

0 comments on commit f439d0e

Please sign in to comment.