0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/sslSpecial/ssl_mixedmode.js

30 lines
1.1 KiB
JavaScript
Raw Normal View History

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
// expected behavior is verified.
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};
var clientOptions =
sslShell ? SSLTest.prototype.defaultSSLClientOptions : SSLTest.prototype.noSSLClientOptions;
var fixture = new SSLTest(serverOptionOverrides, clientOptions);
print("Trying sslMode: '" + sslMode + "' with sslShell = " + sslShell +
"; expect connection to " + (shouldSucceed ? "SUCCEED" : "FAIL"));
assert.eq(shouldSucceed, fixture.connectWorked());
2013-10-11 19:56:29 +02: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);