Fix Flaky Ratpack Fork Test
Ratpack tests occasionally fail with the handler span and manually started span out of order. This will ensure that if a span is manually started inside of the handler then it will be finished after the handler span is finished, which is when the request has been responded to.
This commit is contained in:
parent
44aadf36ce
commit
26c354dad2
|
@ -320,12 +320,16 @@ class RatpackTest extends AgentTestRunner {
|
||||||
((TraceScope) scope).setAsyncPropagation(true)
|
((TraceScope) scope).setAsyncPropagation(true)
|
||||||
}
|
}
|
||||||
scope.span().setBaggageItem("test-baggage", "foo")
|
scope.span().setBaggageItem("test-baggage", "foo")
|
||||||
context.render(testPromise().fork())
|
|
||||||
|
|
||||||
if (startSpanInHandler) {
|
context.onClose {
|
||||||
((TraceScope) scope).setAsyncPropagation(false)
|
if (startSpanInHandler) {
|
||||||
|
final Scope activeScope = GlobalTracer.get().scopeManager().active()
|
||||||
|
((TraceScope) activeScope).setAsyncPropagation(false)
|
||||||
|
activeScope.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scope.close()
|
|
||||||
|
context.render(testPromise().fork())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue