Merge pull request #841 from DataDog/mar-kolya/ignore-flaky-test

Wait for span to finish in apache-http-aync test
This commit is contained in:
Nikolay Martynov 2019-05-17 13:13:38 -04:00 committed by GitHub
commit 48f951cee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import datadog.trace.agent.test.base.HttpClientTest
import datadog.trace.instrumentation.apachehttpasyncclient.ApacheHttpAsyncClientDecorator
import io.opentracing.util.GlobalTracer
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.nio.client.HttpAsyncClients
import org.apache.http.message.BasicHeader
@ -33,6 +34,10 @@ class ApacheHttpAsyncClientNullCallbackTest extends HttpClientTest<ApacheHttpAsy
Future future = client.execute(request, null)
future.get()
if (callback != null) {
// Request span is closed asynchronously even in regards to returned future so we have to wait here.
if (GlobalTracer.get().activeSpan() != null) {
blockUntilChildSpansFinished(1)
}
callback()
}
return 200