2013-10-11 19:56:29 +02:00
|
|
|
// Test the --sslMode parameter
|
|
|
|
// This tests runs through the 8 possible combinations of sslMode values
|
|
|
|
// and SSL-enabled and disabled shell respectively. For each combination
|
2015-06-30 00:35:47 +02:00
|
|
|
// expected behavior is verified.
|
2013-12-12 21:16:14 +01:00
|
|
|
|
2015-06-30 00:35:47 +02:00
|
|
|
load("jstests/libs/ssl_test.js");
|
2013-10-11 19:56:29 +02:00
|
|
|
|
|
|
|
function testCombination(sslMode, sslShell, shouldSucceed) {
|
2016-05-28 23:55:12 +02:00
|
|
|
var serverOptionOverrides = {sslMode: sslMode};
|
2015-06-30 00:35:47 +02:00
|
|
|
|
2016-03-09 18:17:50 +01:00
|
|
|
var clientOptions =
|
|
|
|
sslShell ? SSLTest.prototype.defaultSSLClientOptions : SSLTest.prototype.noSSLClientOptions;
|
2015-06-30 00:35:47 +02:00
|
|
|
|
|
|
|
var fixture = new SSLTest(serverOptionOverrides, clientOptions);
|
|
|
|
|
2016-03-09 18:17:50 +01:00
|
|
|
print("Trying sslMode: '" + sslMode + "' with sslShell = " + sslShell +
|
2015-06-30 00:35:47 +02:00
|
|
|
"; expect connection to " + (shouldSucceed ? "SUCCEED" : "FAIL"));
|
|
|
|
|
|
|
|
assert.eq(shouldSucceed, fixture.connectWorked());
|
2013-10-11 19:56:29 +02:00
|
|
|
}
|
|
|
|
|
2013-11-14 20:08:35 +01:00
|
|
|
testCombination("disabled", false, true);
|
|
|
|
testCombination("allowSSL", false, true);
|
|
|
|
testCombination("preferSSL", false, true);
|
|
|
|
testCombination("requireSSL", false, false);
|
|
|
|
testCombination("disabled", true, false);
|
|
|
|
testCombination("allowSSL", true, true);
|
|
|
|
testCombination("preferSSL", true, true);
|
|
|
|
testCombination("requireSSL", true, true);
|