summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishnu Kaushik <vishnu.kaushik@mongodb.com>2021-06-27 21:43:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-15 23:07:34 +0000
commit38c21f135436e691cd95577e4e81ec87fd8f6879 (patch)
tree9ed818bf0f3969777230199ed9016c1ed0d41530
parent31e40eba338fcaf2395ec285fd5c476622ec5f95 (diff)
downloadmongo-38c21f135436e691cd95577e4e81ec87fd8f6879.tar.gz
SERVER-58119 single_node_set_new_hostname.js needs to call replSetReconfig with an assert.soonNoExcept
-rw-r--r--jstests/replsets/single_node_set_new_hostname.js10
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();