Skip to content

Commit 41b2773

Browse files
committed
Align Prose Test with Spec
1 parent bce97d4 commit 41b2773

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

driver-sync/src/test/functional/com/mongodb/client/ServerDiscoveryAndMonitoringProseTests.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,12 @@ public void testConnectionPoolBackpressure() throws InterruptedException {
322322
}
323323
}
324324

325-
long connectionErrorCount = connectionPoolListener.getEvents().stream()
326-
.filter(e -> e instanceof ConnectionCheckOutFailedEvent)
327-
.map(e -> ((ConnectionCheckOutFailedEvent) e).getReason())
328-
.filter(r -> r == ConnectionCheckOutFailedEvent.Reason.CONNECTION_ERROR)
329-
.count();
330-
assertTrue("Expected at least 10 ConnectionCheckOutFailedEvents with CONNECTION_ERROR, but got "
331-
+ connectionErrorCount,
332-
connectionErrorCount >= 10);
325+
int failedCheckOutCount = connectionPoolListener.countEvents(ConnectionCheckOutFailedEvent.class);
326+
assertTrue("Expected at least 10 ConnectionCheckOutFailedEvents, but got " + failedCheckOutCount,
327+
failedCheckOutCount >= 10);
333328
assertEquals(0, connectionPoolListener.countEvents(ConnectionPoolClearedEvent.class));
334329
} finally {
330+
Thread.sleep(1000);
335331
adminDatabase.runCommand(new Document("setParameter", 1)
336332
.append("ingressConnectionEstablishmentRateLimiterEnabled", false));
337333
}

0 commit comments

Comments
 (0)