summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2020-07-09 18:44:38 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-20 21:46:01 +0000
commit001e6e2d180eea5262dc524675ef1cfab8fb8f8f (patch)
tree087fa1e6495fdc07498e37acd5b9e17d18a82194
parent34b09564b149617f25be3526faff28b16e5859a8 (diff)
downloadmongo-001e6e2d180eea5262dc524675ef1cfab8fb8f8f.tar.gz
SERVER-48673 Allow retrying establishing a connection to a replica set in getReplSetName in the event of a network error
-rw-r--r--jstests/concurrency/fsm_libs/fsm.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/jstests/concurrency/fsm_libs/fsm.js b/jstests/concurrency/fsm_libs/fsm.js
index e3b8fc0c16b..c317258b382 100644
--- a/jstests/concurrency/fsm_libs/fsm.js
+++ b/jstests/concurrency/fsm_libs/fsm.js
@@ -54,7 +54,17 @@ var fsm = (function() {
};
const getReplSetName = (conn) => {
- const res = assert.commandWorked(conn.getDB('admin').runCommand({isMaster: 1}));
+ let res;
+ assert.soonNoExcept(
+ () => {
+ res = conn.getDB('admin').runCommand({isMaster: 1});
+ return true;
+ },
+ "Failed to establish a connection to the replica set",
+ undefined, // default timeout is 10 mins
+ 2 * 1000); // retry on a 2 second interval
+
+ assert.commandWorked(res);
assert.eq('string',
typeof res.setName,
() => `not connected to a replica set: ${tojson(res)}`);