Skip to content

Commit 5cf7cbb

Browse files
committed
Fix race condition in test caused by a to a too-short timeout
1 parent 7d3a663 commit 5cf7cbb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

driver-core/src/test/unit/com/mongodb/connection/BaseClusterSpecification.groovy

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,16 @@ class BaseClusterSpecification extends Specification {
257257
def thirdServerLatch = selectServerAsync(cluster, thirdServer)
258258
factory.sendNotification(secondServer, REPLICA_SET_SECONDARY, allServers)
259259
factory.sendNotification(thirdServer, REPLICA_SET_SECONDARY, allServers)
260-
secondServerLatch.latch.await()
261-
thirdServerLatch.latch.await()
262260

263261
then:
264-
secondServerLatch.server.description.address == secondServer
265-
thirdServerLatch.server.description.address == thirdServer
262+
secondServerLatch.get().description.address == secondServer
263+
thirdServerLatch.get().description.address == thirdServer
266264

267265
cleanup:
268266
cluster?.close()
269267

270268
where:
271-
serverSelectionTimeoutMS << [30, -1]
269+
serverSelectionTimeoutMS << [500, -1]
272270
}
273271

274272
def 'when selecting server asynchronously should send MongoClientException to callback if cluster is closed before success'() {

0 commit comments

Comments
 (0)