File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
instrumentation/rack/test/opentelemetry/instrumentation/rack/middlewares Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 312312 end
313313
314314 describe 'config[:response_propagators]' do
315+ describe 'with default options' do
316+ it 'does not inject the traceresponse header' do
317+ res = Rack ::MockRequest . new ( rack_builder ) . get ( '/ping' , env )
318+ _ ( res . headers ) . wont_include ( 'traceresponse' )
319+ end
320+ end
321+
315322 describe 'with ResponseTextMapPropagator' do
316323 let ( :config ) { default_config . merge ( response_propagators : [ OpenTelemetry ::Trace ::Propagation ::TraceContext ::ResponseTextMapPropagator . new ] ) }
317324
320327 _ ( res . headers ) . must_include ( 'traceresponse' )
321328 end
322329 end
330+
331+ describe 'propagator throws' do
332+ class MockPropagator < OpenTelemetry ::Trace ::Propagation ::TraceContext ::ResponseTextMapPropagator
333+ def inject ( carrier )
334+ raise 'Injection failed'
335+ end
336+ end
337+
338+ let ( :config ) { default_config . merge ( response_propagators : [ MockPropagator . new ] ) }
339+
340+ it 'handles the error gracefully' do
341+ res = Rack ::MockRequest . new ( rack_builder ) . get ( '/ping' , env )
342+ _ ( res . headers ) . wont_include ( 'traceresponse' )
343+ end
344+ end
323345 end
324346
325347 describe '#call with error' do
You can’t perform that action at this time.
0 commit comments