Skip to content

Commit

Permalink
SERVER-16371 fix ssl tests to not share replica set monitors between …
Browse files Browse the repository at this point in the history
…sub-runs
  • Loading branch information
milkie committed Dec 1, 2014
1 parent 566ac19 commit 2fe551d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
14 changes: 9 additions & 5 deletions jstests/replsets/replset1.js
@@ -1,16 +1,20 @@
load("jstests/replsets/rslib.js");
var ssl_options1;
var ssl_options2;
doTest = function( signal ) {
var ssl_name;
load("jstests/replsets/rslib.js");
var doTest = function( signal ) {

// Test basic replica set functionality.
// -- Replication
// -- Failover

// Replica set testing API
// Create a new replica set test. Specify set name and the number of nodes you want.


// Choose a name that is unique to the options specified.
// This is important because we are depending on a fresh replicaSetMonitor for each run;
// each differently-named replica set gets its own monitor.
// n0 and n1 get the same SSL config since there are 3 nodes but only 2 different configs
var replTest = new ReplSetTest( {name: 'testSet', nodes:
var replTest = new ReplSetTest( {name: 'testSet' + ssl_name, nodes:
{n0: ssl_options1, n1: ssl_options1, n2: ssl_options2}});

// call startSet() to start each mongod in the replica set
Expand Down
6 changes: 4 additions & 2 deletions jstests/ssl/libs/ssl_helpers.js
Expand Up @@ -25,17 +25,19 @@ var requireSSL = {sslMode : "requireSSL",

var replSetTestFile = "jstests/replsets/replset1.js";

var replShouldSucceed = function(opt1, opt2) {
var replShouldSucceed = function(name, opt1, opt2) {
ssl_options1 = opt1;
ssl_options2 = opt2;
ssl_name = name;
// try running this file using the given config
load(replSetTestFile);
};

// Test if ssl replset configs fail
var replShouldFail = function(opt1, opt2) {
var replShouldFail = function(name, opt1, opt2) {
ssl_options1 = opt1;
ssl_options2 = opt2;
ssl_name = name;
replTest = null;
assert.throws(load,[replSetTestFile],
"This setup should have failed");
Expand Down
8 changes: 4 additions & 4 deletions jstests/ssl/mixed_mode_repl.js
Expand Up @@ -8,16 +8,16 @@ load("jstests/ssl/libs/ssl_helpers.js")

// Verify that requireSSL allows ssl connections
print("=== Testing requireSSL/requireSSL cluster ===");
replShouldSucceed( requireSSL, requireSSL);
replShouldSucceed("require-require", requireSSL, requireSSL);

// Test mixed sslMode allowSSL/preferSSL
print("=== Testing allowSSL/preferSSL cluster ===");
replShouldSucceed(allowSSL, preferSSL);
replShouldSucceed("allow-prefer", allowSSL, preferSSL);

// Test mixed sslMode preferSSL/requireSSL
print("=== Testing preferSSL/requireSSL cluster ===")
replShouldSucceed( preferSSL, requireSSL);
replShouldSucceed("prefer-require", preferSSL, requireSSL);

// Test mixed sslMode disabled/preferSSL - should fail
print("=== Testing allowSSL/requireSSL cluster - SHOULD FAIL ===");
replShouldFail(allowSSL, requireSSL);
replShouldFail("allow-require", allowSSL, requireSSL);
8 changes: 4 additions & 4 deletions jstests/sslSpecial/mixed_mode_repl_nossl.js
Expand Up @@ -7,16 +7,16 @@ load("jstests/ssl/libs/ssl_helpers.js")

// Verify that disabled allows non-ssl connections
print("=== Testing disabled cluster ===");
replShouldSucceed(disabled, disabled);
replShouldSucceed("disabled-disabled", disabled, disabled);

// Test mixed sslMode allowSSL/preferSSL with non-ssl client
print("=== Testing allowSSL/preferSSL cluster ===");
replShouldSucceed(allowSSL, preferSSL);
replShouldSucceed("allow-prefer", allowSSL, preferSSL);

// Test mixed sslMode allowSSL/disabled with non-ssl client
print("=== Testing allowSSL/disabled cluster ===");
replShouldSucceed(allowSSL, disabled);
replShouldSucceed("allow-disabled", allowSSL, disabled);

// Test mixed sslMode disables/preferSSL - should fail with non-ssl client
print("=== Testing disabled/preferSSL cluster - SHOULD FAIL ===");
replShouldFail(disabled, preferSSL);
replShouldFail("disabled-disabled", disabled, preferSSL);

0 comments on commit 2fe551d

Please sign in to comment.