diff options
Diffstat (limited to 'jstests/replsets/single_node_set_new_hostname.js')
-rw-r--r-- | jstests/replsets/single_node_set_new_hostname.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/jstests/replsets/single_node_set_new_hostname.js b/jstests/replsets/single_node_set_new_hostname.js index 484cf65a1cf..4dc0583c8d9 100644 --- a/jstests/replsets/single_node_set_new_hostname.js +++ b/jstests/replsets/single_node_set_new_hostname.js @@ -41,9 +41,15 @@ jsTestLog(`Original config: ${tojson(config)}`); config.version++; config.members[0].host = newHostAndPort; jsTestLog(`New config: ${tojson(config)}`); + // Force reconfig since the restarted node is in REMOVED state, not PRIMARY. -assert.commandWorked( - restartedNode.getDB("admin").runCommand({replSetReconfig: config, force: true})); +// The connection to the mongod may have been closed after reaching the REMOVED state. In case of a +// network error, retry the command until it succeeds. +assert.soonNoExcept(() => { + assert.commandWorked( + restartedNode.getDB("admin").runCommand({replSetReconfig: config, force: true})); + return true; +}, `Couldn't run 'replSetReconfig' with config ${config} on the node ${newHostAndPort}`); waitForState(restartedNode, ReplSetTest.State.PRIMARY); replTest.stopSet(); |