summaryrefslogtreecommitdiff
path: root/jstests/ssl/libs/ssl_helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/ssl/libs/ssl_helpers.js')
-rw-r--r--jstests/ssl/libs/ssl_helpers.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/jstests/ssl/libs/ssl_helpers.js b/jstests/ssl/libs/ssl_helpers.js
index 1c275a9641a..6dc20a4923c 100644
--- a/jstests/ssl/libs/ssl_helpers.js
+++ b/jstests/ssl/libs/ssl_helpers.js
@@ -104,6 +104,7 @@ function testShardedLookup(shardingTest) {
* sharding test to see if they can work together...
*/
function mixedShardTest(options1, options2, shouldSucceed) {
+ let authSucceeded = false;
try {
// Start ShardingTest with enableBalancer because ShardingTest attempts to turn
// off the balancer otherwise, which it will not be authorized to do if auth is enabled.
@@ -119,6 +120,8 @@ function mixedShardTest(options1, options2, shouldSucceed) {
st.admin.createUser({user: 'admin', pwd: 'pwd', roles: ['root']});
st.admin.auth('admin', 'pwd');
+ authSucceeded = true;
+
st.stopBalancer();
// Test that $lookup works because it causes outgoing connections to be opened
@@ -158,6 +161,12 @@ function mixedShardTest(options1, options2, shouldSucceed) {
// silence error if we should fail...
print("IMPORTANT! => Test failed when it should have failed...continuing...");
} finally {
+ // Authenticate csrs so ReplSetTest.stopSet() can do db hash check.
+ if (authSucceeded && st.configRS) {
+ st.configRS.nodes.forEach((node) => {
+ node.getDB('admin').auth('admin', 'pwd');
+ });
+ }
// This has to be done in order for failure
// to not prevent future tests from running...
if (st) {