Skip to content

Commit efee1d5

Browse files
committed
In ServerDiscoveryAndMonitoringTest, added missing assertion to ensure that the cluster description contains no unexpected server descriptions.
1 parent 270f03c commit efee1d5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

driver-core/src/test/unit/com/mongodb/connection/ServerDiscoveryAndMonitoringTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import static java.util.Arrays.asList;
4545
import static org.junit.Assert.assertEquals;
4646
import static org.junit.Assert.assertNotNull;
47+
import static org.junit.Assert.fail;
4748

4849
// See https://github.com/mongodb/specifications/tree/master/source/server-discovery-and-monitoring/tests
4950
@RunWith(Parameterized.class)
@@ -80,6 +81,10 @@ public static Collection<Object[]> data() throws URISyntaxException, IOException
8081
}
8182

8283
private void assertServers(final BsonDocument servers) {
84+
if (servers.size() != cluster.getCurrentDescription().getAll().size()) {
85+
fail("Cluster description contains servers that are not part of the expected outcome");
86+
}
87+
8388
for (String serverName : servers.keySet()) {
8489
assertServer(serverName, servers.getDocument(serverName));
8590
}

0 commit comments

Comments
 (0)