0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-27 23:27:11 +01:00
mongodb/jstests/ssl/mixed_mode_repl.js
Matt Broadstone 771dabd098 SERVER-81339 Convert ReplSetTest and ShardingTest to modules (#26332)
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
2024-08-20 22:00:49 +00:00

34 lines
1.2 KiB
JavaScript

// This test is related to mixed_mode_repl_nossl.js in
// the sslSpecial test set. This test must be run with --use-ssl
import {ReplSetTest} from "jstests/libs/replsettest.js";
import {
allowTLS,
preferTLS,
replShouldFail,
replShouldSucceed,
requireTLS
} from "jstests/ssl/libs/ssl_helpers.js";
// Limit the amount of time we'll wait on a failure.
// Apply equally to success tests as well so that
// a failure to complete replication is more likely to
// give us a false negative, than a false positive.
ReplSetTest.kDefaultTimeoutMS = 3 * 60 * 1000;
// Verify that requireTLS allows ssl connections
print("=== Testing requireTLS/requireTLS cluster ===");
replShouldSucceed("require-require", requireTLS, requireTLS);
// Test mixed tlsMode allowTLS/preferTLS
print("=== Testing allowTLS/preferTLS cluster ===");
replShouldSucceed("allow-prefer", allowTLS, preferTLS);
// Test mixed tlsMode preferTLS/requireTLS
print("=== Testing preferTLS/requireTLS cluster ===");
replShouldSucceed("prefer-require", preferTLS, requireTLS);
// Test mixed tlsMode disabled/preferTLS - should fail
print("=== Testing allowTLS/requireTLS cluster - SHOULD FAIL ===");
replShouldFail("allow-require", allowTLS, requireTLS);