Test propagation across non-tracing contexts
This commit is contained in:
parent
81b70fb0e4
commit
4bebce2f56
|
|
@ -32,6 +32,22 @@ class ScalaConcurrentTests {
|
||||||
return 5
|
return 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Trace
|
||||||
|
def tracedAcrossThreadsWithNoTrace() :Integer = {
|
||||||
|
val goodFuture: Future[Integer] = Future {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
goodFuture onSuccess {
|
||||||
|
case _ => Future {
|
||||||
|
2
|
||||||
|
} onSuccess {
|
||||||
|
case _ => tracedChild("callback")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Number of expected spans in the trace
|
* @return Number of expected spans in the trace
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,17 @@ class ExecutorInstrumentationTest extends Specification {
|
||||||
trace.size() == expectedNumberOfSpans
|
trace.size() == expectedNumberOfSpans
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def "scala propagates across futures with no traces"() {
|
||||||
|
setup:
|
||||||
|
ScalaConcurrentTests scalaTest = new ScalaConcurrentTests()
|
||||||
|
int expectedNumberOfSpans = scalaTest.tracedAcrossThreadsWithNoTrace()
|
||||||
|
testWriter.waitForTraces(1)
|
||||||
|
List<DDSpan> trace = testWriter.get(0)
|
||||||
|
|
||||||
|
expect:
|
||||||
|
trace.size() == expectedNumberOfSpans
|
||||||
|
}
|
||||||
|
|
||||||
def "scala either promise completion"() {
|
def "scala either promise completion"() {
|
||||||
setup:
|
setup:
|
||||||
ScalaConcurrentTests scalaTest = new ScalaConcurrentTests()
|
ScalaConcurrentTests scalaTest = new ScalaConcurrentTests()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue