summaryrefslogtreecommitdiff
path: root/jstests/ssl/mixed_mode_sharded_transition.js
blob: f6b0d7bbaec0e3619a48950ba2d178485e694d42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Tests simultaneous upgrade from noauth/no-ssl to x509/requireSSL on a sharded cluster.
 * The purpose is to verify the connectivity between mongos, config server, and the shards
 *
 * NOTE: This test is similar to the mixed_mode_sharded_transition.js in the sslSpecial
 * test suite. This suite must use ssl so it cannot test modes without ssl.
 */

load('jstests/ssl/libs/ssl_helpers.js');

(function() {
'use strict';

const disableResumableRangeDeleter = true;

var transitionToX509AllowSSL =
    Object.merge(allowSSL, {transitionToAuth: '', clusterAuthMode: 'x509'});
var transitionToX509PreferSSL =
    Object.merge(preferSSL, {transitionToAuth: '', clusterAuthMode: 'x509'});
var x509RequireSSL = Object.merge(requireSSL, {clusterAuthMode: 'x509'});

function testCombos(opt1, opt2, shouldSucceed) {
    mixedShardTest(opt1, opt2, shouldSucceed, disableResumableRangeDeleter);
    mixedShardTest(opt2, opt1, shouldSucceed, disableResumableRangeDeleter);
}

print('=== Testing transitionToAuth/allowSSL - transitionToAuth/preferSSL cluster ===');
testCombos(transitionToX509AllowSSL, transitionToX509PreferSSL, true);

print('=== Testing transitionToAuth/preferSSL - transitionToAuth/preferSSL cluster ===');
mixedShardTest(
    transitionToX509PreferSSL, transitionToX509PreferSSL, true, disableResumableRangeDeleter);

print('=== Testing transitionToAuth/preferSSL - x509/requireSSL cluster ===');
testCombos(transitionToX509PreferSSL, x509RequireSSL, true);
}());