diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2022-05-09 20:10:19 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-13 20:38:41 +0000 |
commit | b5adaa6136f050d0df7cb80aa7f6886c4f058a2f (patch) | |
tree | 26e8c8bda294ce1a246ca612fd2b8af0c4e5a7a9 | |
parent | 39afcf31d3036d9db06b614efcb04bafb69e7053 (diff) | |
download | mongo-b5adaa6136f050d0df7cb80aa7f6886c4f058a2f.tar.gz |
SERVER-66329 Authenticate connections during rollover tests
(cherry picked from commit 9b3509a2217da69cca3e549a164ac7e6e26902d0)
-rw-r--r-- | jstests/sslSpecial/x509_cluster_auth_rollover.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/jstests/sslSpecial/x509_cluster_auth_rollover.js b/jstests/sslSpecial/x509_cluster_auth_rollover.js index 06ce3c1653b..3de26be9873 100644 --- a/jstests/sslSpecial/x509_cluster_auth_rollover.js +++ b/jstests/sslSpecial/x509_cluster_auth_rollover.js @@ -31,6 +31,14 @@ rst.nodes.forEach((node) => { assert(node.getDB("admin").auth("root", "root")); }); +// Future connections should authenticate immediately on connecting so that replSet actions succeed. +const originalAwaitConnection = MongoRunner.awaitConnection; +MongoRunner.awaitConnection = function(args) { + const conn = originalAwaitConnection(args); + assert(conn.getDB('admin').auth('root', 'root')); + return conn; +}; + // All the certificates' DNs share this base const dnBase = "C=US, ST=New York, L=New York,"; // This is the DN of the rollover certificate. @@ -48,14 +56,6 @@ const rolloverConfig = function(newConfig) { rst.nodeOptions[configId] = Object.merge(rst.nodeOptions[configId], newConfig, true); const newNode = rst.start(nodeId, {}, true, true); rst.awaitSecondaryNodes(); - // Even though we waited for this node to become SECONDARY, it may go into rollback - // thereafter, so this auth command must be tolerant of that disconnection. - let authResult; - assert.soonNoExcept(function() { - authResult = newNode.getDB("admin").auth("root", "root"); - return true; - }); - assert(authResult); }; rst.nodes.forEach(function(node) { |