Enable strict context check on grizzly (#3921)
* Enable strict context check on grizzly * add comment * move wait to base class
This commit is contained in:
parent
a2928663f4
commit
ec585c7717
|
@ -26,11 +26,5 @@ tasks.withType<Test>().configureEach {
|
||||||
jvmArgs("-Dotel.instrumentation.grizzly.enabled=true")
|
jvmArgs("-Dotel.instrumentation.grizzly.enabled=true")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
|
||||||
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/2640
|
|
||||||
jvmArgs("-Dio.opentelemetry.javaagent.shaded.io.opentelemetry.context.enableStrictContext=false")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Requires old Guava. Can't use enforcedPlatform since predates BOM
|
// Requires old Guava. Can't use enforcedPlatform since predates BOM
|
||||||
configurations.testRuntimeClasspath.resolutionStrategy.force("com.google.guava:guava:19.0")
|
configurations.testRuntimeClasspath.resolutionStrategy.force("com.google.guava:guava:19.0")
|
||||||
|
|
|
@ -8,9 +8,11 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
|
||||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM
|
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM
|
||||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT
|
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT
|
||||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
||||||
|
import static org.awaitility.Awaitility.await
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.ws.rs.GET
|
import javax.ws.rs.GET
|
||||||
import javax.ws.rs.NotFoundException
|
import javax.ws.rs.NotFoundException
|
||||||
import javax.ws.rs.Path
|
import javax.ws.rs.Path
|
||||||
|
@ -45,6 +47,23 @@ class GrizzlyTest extends HttpServerTest<HttpServer> implements AgentTestTrait {
|
||||||
server.stop()
|
server.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def cleanup() {
|
||||||
|
// wait for async request threads to complete
|
||||||
|
await()
|
||||||
|
.atMost(15, TimeUnit.SECONDS)
|
||||||
|
.until({ !isRequestRunning() })
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean isRequestRunning() {
|
||||||
|
def result = Thread.getAllStackTraces().values().find {stackTrace ->
|
||||||
|
def element = stackTrace.find {
|
||||||
|
return ((it.className == "org.glassfish.grizzly.http.server.HttpHandler\$1" && it.methodName == "run"))
|
||||||
|
}
|
||||||
|
element != null
|
||||||
|
}
|
||||||
|
return result != null
|
||||||
|
}
|
||||||
|
|
||||||
static class SimpleExceptionMapper implements ExceptionMapper<Throwable> {
|
static class SimpleExceptionMapper implements ExceptionMapper<Throwable> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue