Test propagation across non-tracing contexts

This commit is contained in:
Andrew Kent 2018-03-09 11:27:27 -08:00
parent 81b70fb0e4
commit 4bebce2f56
2 changed files with 27 additions and 0 deletions

View File

@ -32,6 +32,22 @@ class ScalaConcurrentTests {
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
*/

View File

@ -136,6 +136,17 @@ class ExecutorInstrumentationTest extends Specification {
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"() {
setup:
ScalaConcurrentTests scalaTest = new ScalaConcurrentTests()