summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2020-10-07 09:48:15 +0200
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-07 15:32:18 +0000
commite370b1577497516d9c488d0c58e2e13b5b7800be (patch)
tree76044d101f83dbbe95d83cb0347ff729c2642196
parent05b8d1423832addcbccd7ec04448ea13fc6ba1c2 (diff)
downloadmongo-e370b1577497516d9c488d0c58e2e13b5b7800be.tar.gz
SERVER-51406 Wait for failed configsvr replica set host discovery
-rw-r--r--jstests/sharding/primary_config_server_blackholed_from_mongos.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/jstests/sharding/primary_config_server_blackholed_from_mongos.js b/jstests/sharding/primary_config_server_blackholed_from_mongos.js
index 22a4f4502cf..df08df55db7 100644
--- a/jstests/sharding/primary_config_server_blackholed_from_mongos.js
+++ b/jstests/sharding/primary_config_server_blackholed_from_mongos.js
@@ -52,7 +52,15 @@ assert.writeError(
.TestColl.insert({_id: 0, value: 'This value will never be inserted'}, {maxTimeMS: 15000}));
jsTest.log('Doing CRUD operations on the sharded collection');
-assert.eq(1000, testDB.ShardedColl.find().itcount());
+assert.soon(() => {
+ // eventually the mongos will route the traffic to a secondary of the config replica set
+ try {
+ return testDB.ShardedColl.countDocuments({}) === 1000;
+ } catch (err) {
+ jsTest.log("Attempt to count documents failed with error: " + err);
+ }
+ return false;
+});
assert.commandWorked(testDB.ShardedColl.insert({_id: 1000}));
assert.eq(1001, testDB.ShardedColl.find().count());