diff --git a/instrumentation/mongo/mongo-4.0/javaagent/src/test/groovy/Mongo4ReactiveClientTest.groovy b/instrumentation/mongo/mongo-4.0/javaagent/src/test/groovy/Mongo4ReactiveClientTest.groovy index 8d4f9a4e9e..6b62b75412 100644 --- a/instrumentation/mongo/mongo-4.0/javaagent/src/test/groovy/Mongo4ReactiveClientTest.groovy +++ b/instrumentation/mongo/mongo-4.0/javaagent/src/test/groovy/Mongo4ReactiveClientTest.groovy @@ -23,11 +23,14 @@ import spock.lang.Shared import java.util.concurrent.CompletableFuture import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit class Mongo4ReactiveClientTest extends AbstractMongoClientTest> implements AgentTestTrait { @Shared MongoClient client + @Shared + List cleanup = [] def setupSpec() throws Exception { client = MongoClients.create("mongodb://localhost:$port") @@ -36,18 +39,27 @@ class Mongo4ReactiveClientTest extends AbstractMongoClientTest() db.getCollection(collectionName).estimatedDocumentCount().subscribe(toSubscriber { count.complete(it) }) - return count.join() + return count.get(30, TimeUnit.SECONDS) } @Override @@ -81,7 +97,7 @@ class Mongo4ReactiveClientTest extends AbstractMongoClientTest toSubscriber(Closure closure) { + Subscriber toSubscriber(Closure closure) { return new Subscriber() { boolean hasResult