diff --git a/spec/datadog/tracing/contrib/rack/integration_test_spec.rb b/spec/datadog/tracing/contrib/rack/integration_test_spec.rb index 15ce8bc28a..56453bc4e5 100644 --- a/spec/datadog/tracing/contrib/rack/integration_test_spec.rb +++ b/spec/datadog/tracing/contrib/rack/integration_test_spec.rb @@ -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 @@ -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 @@ -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