diff options
-rw-r--r-- | jstests/concurrency/fsm_libs/fsm.js | 12 |
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)}`); |