From 38c21f135436e691cd95577e4e81ec87fd8f6879 Mon Sep 17 00:00:00 2001 From: Vishnu Kaushik Date: Sun, 27 Jun 2021 21:43:37 +0000 Subject: SERVER-58119 single_node_set_new_hostname.js needs to call replSetReconfig with an assert.soonNoExcept --- jstests/replsets/single_node_set_new_hostname.js | 10 ++++++++-- 1 file 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(); -- cgit v1.2.1