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:18:46 +0000
commit0b01caf40a5a610685c0bf590ff2fa54aadd0443 (patch)
tree0a3bd466b30f2e824fad1642b53ba0dc9cd53160
parent18f93bfb7a2931c474aa8ee9dae990a0d5ec8442 (diff)
downloadmongo-0b01caf40a5a610685c0bf590ff2fa54aadd0443.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();