diff options
-rw-r--r-- | jstests/replsets/test_command.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/replsets/test_command.js b/jstests/replsets/test_command.js index 37db262bd81..abaf10bc56d 100644 --- a/jstests/replsets/test_command.js +++ b/jstests/replsets/test_command.js @@ -26,6 +26,24 @@ }), 'node 0' + replSet.nodes[0].host + ' failed to become primary'); + // We need the try/catch to handle that the node may have hung up the connection due + // to a state change. + try { + assert.commandWorked(replSet.nodes[1].adminCommand({ + replSetTest: 1, + waitForMemberState: ReplSetTest.State.SECONDARY, + timeoutMillis: 60 * 1000, + })); + } catch (e) { + jsTestLog(e); + assert.commandWorked(replSet.nodes[1].adminCommand({ + replSetTest: 1, + waitForMemberState: ReplSetTest.State.SECONDARY, + timeoutMillis: 60 * 1000, + }), + 'node 1' + replSet.nodes[1].host + ' failed to become secondary'); + } + var primary = replSet.getPrimary(); var secondary = replSet.getSecondary(); |