diff options
author | Gabriel Marks <gabriel.marks@mongodb.com> | 2022-01-18 21:48:58 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-20 18:16:25 +0000 |
commit | 6816a8a21319aba10661e188d70347271bbef1b4 (patch) | |
tree | 716addef81951f83a0be732de4f9ef5126334e4c | |
parent | 2eab6f522163e9f910401e3997c69298e4b66d70 (diff) | |
download | mongo-6816a8a21319aba10661e188d70347271bbef1b4.tar.gz |
SERVER-59779 Wrap ReplSetTest.freeze with asCluster()
(cherry picked from commit 2a763ca4ea023341983ca8f5e89fa214a56e331c)
-rw-r--r-- | src/mongo/shell/replsettest.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 8b9dabef9e3..09238cf8649 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -3007,10 +3007,15 @@ var ReplSetTest = function(opts) { this.freeze = _nodeParamToSingleNode(_nodeParamToConn(function(node) { assert.soon(() => { try { - // Ensure node is not primary. Ignore errors, probably means it's already secondary. - node.adminCommand({replSetStepDown: ReplSetTest.kForeverSecs, force: true}); - // Prevent node from running election. Fails if it already started an election. - assert.commandWorked(node.adminCommand({replSetFreeze: ReplSetTest.kForeverSecs})); + // Ensure node is authenticated. + asCluster(node, () => { + // Ensure node is not primary. Ignore errors, probably means it's already + // secondary. + node.adminCommand({replSetStepDown: ReplSetTest.kForeverSecs, force: true}); + // Prevent node from running election. Fails if it already started an election. + assert.commandWorked( + node.adminCommand({replSetFreeze: ReplSetTest.kForeverSecs})); + }); return true; } catch (e) { if (isNetworkError(e) || e.code === ErrorCodes.NotSecondary || |