Skip to content

Commit 27889e7

Browse files
committed
Fix BaseClusterSpecification tests
They should check the return value of CountDownLatch#await
1 parent 80fdeed commit 27889e7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,18 @@ class BaseClusterSpecification extends Specification {
213213
def latch = new CountDownLatch(1)
214214
def thread = new Thread({
215215
try {
216-
cluster.selectServer()(new ReadPreferenceServerSelector(ReadPreference.primary()))
216+
cluster.selectServer(new ReadPreferenceServerSelector(ReadPreference.primary()))
217217
} catch (MongoInterruptedException e) {
218218
latch.countDown()
219219
}
220220
})
221221
thread.start()
222222
sleep(1000)
223223
thread.interrupt()
224-
latch.await(ClusterFixture.TIMEOUT, SECONDS)
224+
def interrupted = latch.await(ClusterFixture.TIMEOUT, SECONDS)
225225

226226
then:
227-
true
227+
interrupted
228228

229229
cleanup:
230230
cluster?.close()
@@ -252,10 +252,10 @@ class BaseClusterSpecification extends Specification {
252252
thread.start()
253253
sleep(1000)
254254
thread.interrupt()
255-
latch.await(ClusterFixture.TIMEOUT, SECONDS)
255+
def interrupted = latch.await(ClusterFixture.TIMEOUT, SECONDS)
256256

257257
then:
258-
true
258+
interrupted
259259

260260
cleanup:
261261
cluster?.close()

0 commit comments

Comments
 (0)