Fix flaky hibernate reactive test (#9338)
This commit is contained in:
parent
bebd819277
commit
68da349386
|
@ -38,6 +38,7 @@ testing {
|
|||
implementation("org.hibernate.reactive:hibernate-reactive-core:1.0.0.Final")
|
||||
implementation("io.vertx:vertx-pg-client:4.1.5")
|
||||
}
|
||||
compileOnly("io.vertx:vertx-codegen:4.1.5")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@ import io.opentelemetry.api.trace.Span;
|
|||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
|
||||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
|
||||
import io.vertx.core.Vertx;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.Persistence;
|
||||
|
@ -117,10 +119,14 @@ class HibernateReactiveTest {
|
|||
|
||||
@Test
|
||||
void testStage() throws Exception {
|
||||
testing
|
||||
.runWithSpan(
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
testing.runWithSpan(
|
||||
"parent",
|
||||
() ->
|
||||
Vertx.vertx()
|
||||
.getOrCreateContext()
|
||||
.runOnContext(
|
||||
event ->
|
||||
stageSessionFactory
|
||||
.withSession(
|
||||
session -> {
|
||||
|
@ -130,10 +136,11 @@ class HibernateReactiveTest {
|
|||
|
||||
return session
|
||||
.find(Value.class, 1L)
|
||||
.thenAccept(value -> testing.runWithSpan("callback", () -> {}));
|
||||
.thenAccept(
|
||||
value -> testing.runWithSpan("callback", () -> {}));
|
||||
})
|
||||
.toCompletableFuture())
|
||||
.get(30, TimeUnit.SECONDS);
|
||||
.thenAccept(unused -> latch.countDown())));
|
||||
latch.await(30, TimeUnit.SECONDS);
|
||||
|
||||
assertTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue