summaryrefslogtreecommitdiff
path: root/jstests/ssl
diff options
context:
space:
mode:
authorKevin Albertson <kevin.albertson@10gen.com>2018-02-08 09:46:57 -0500
committerKevin Albertson <kevin.albertson@10gen.com>2018-02-08 09:46:57 -0500
commitc556e377094792e7253a95cb5fedcd703a99bf2c (patch)
treeb2032e22b5ab1ef21927f2483578cb11df3c341d /jstests/ssl
parente1fdc072a60a0cc47395e09c3d9a796f424e0040 (diff)
downloadmongo-c556e377094792e7253a95cb5fedcd703a99bf2c.tar.gz
SERVER-25640 terminate running processes in jstests
Diffstat (limited to 'jstests/ssl')
-rw-r--r--jstests/ssl/disable_x509.js5
-rw-r--r--jstests/ssl/initial_sync1_x509.js1
-rw-r--r--jstests/ssl/libs/ssl_helpers.js10
-rw-r--r--jstests/ssl/repl_ssl_noca.js1
-rw-r--r--jstests/ssl/shell_option_parsing.js1
-rw-r--r--jstests/ssl/ssl_cert_password.js2
-rw-r--r--jstests/ssl/ssl_cluster_file.js2
-rw-r--r--jstests/ssl/ssl_crl_revoked.js1
-rw-r--r--jstests/ssl/ssl_weak.js3
-rw-r--r--jstests/ssl/ssl_with_system_ca.js5
-rw-r--r--jstests/ssl/upgrade_to_ssl.js1
-rw-r--r--jstests/ssl/upgrade_to_x509_ssl.js1
-rw-r--r--jstests/ssl/x509_client.js1
13 files changed, 26 insertions, 8 deletions
diff --git a/jstests/ssl/disable_x509.js b/jstests/ssl/disable_x509.js
index f23ab91534e..6d251e66b94 100644
--- a/jstests/ssl/disable_x509.js
+++ b/jstests/ssl/disable_x509.js
@@ -43,4 +43,7 @@ if (cmdOut.ok) {
assert(!external.auth({user: CLIENT_USER, mechanism: 'MONGODB-X509'}),
"authentication with disabled auth mechanism succeeded");
-}
+ MongoRunner.stopMongod(conn);
+} else {
+ MongoRunner.stopMongod(conn);
+} \ No newline at end of file
diff --git a/jstests/ssl/initial_sync1_x509.js b/jstests/ssl/initial_sync1_x509.js
index 564756cc6ca..c49ab37df5a 100644
--- a/jstests/ssl/initial_sync1_x509.js
+++ b/jstests/ssl/initial_sync1_x509.js
@@ -100,3 +100,4 @@ var conns = replTest.startSet();
assert.throws(function() {
replTest.initiate();
});
+replTest.stopSet();
diff --git a/jstests/ssl/libs/ssl_helpers.js b/jstests/ssl/libs/ssl_helpers.js
index 6dc20a4923c..ee5d4f05a92 100644
--- a/jstests/ssl/libs/ssl_helpers.js
+++ b/jstests/ssl/libs/ssl_helpers.js
@@ -1,5 +1,9 @@
load('jstests/multiVersion/libs/multi_rs.js');
+// Do not fail if this test leaves unterminated processes because this file expects replset1.js to
+// throw for invalid SSL options.
+TestData.failIfUnterminatedProcesses = false;
+
//=== Shared SSL testing library functions and constants ===
var KEYFILE = "jstests/libs/key1";
@@ -55,12 +59,8 @@ 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");
- // clean up to continue running...
- if (replTest) {
- replTest.stopSet();
- }
+ // Note: this leaves running mongod processes.
};
/**
diff --git a/jstests/ssl/repl_ssl_noca.js b/jstests/ssl/repl_ssl_noca.js
index b006136f679..dedae46d62a 100644
--- a/jstests/ssl/repl_ssl_noca.js
+++ b/jstests/ssl/repl_ssl_noca.js
@@ -48,4 +48,5 @@
var disableSSLURL = `mongodb://${nodeList}/admin?replicaSet=${replTest.name}&ssl=false`;
jsTestLog(`Replica set url (doesnt use SSL): ${disableSSLURL}`);
assert.neq(checkShellOkay(disableSSLURL), 0, "shell correctly failed to connect without SSL");
+ replTest.stopSet();
})();
diff --git a/jstests/ssl/shell_option_parsing.js b/jstests/ssl/shell_option_parsing.js
index cc043d57115..8703e710343 100644
--- a/jstests/ssl/shell_option_parsing.js
+++ b/jstests/ssl/shell_option_parsing.js
@@ -181,4 +181,5 @@
usernameX509,
'--authenticationMechanism',
'MONGODB-X509');
+ rst.stopSet();
})();
diff --git a/jstests/ssl/ssl_cert_password.js b/jstests/ssl/ssl_cert_password.js
index a9590d92777..2595510ff4a 100644
--- a/jstests/ssl/ssl_cert_password.js
+++ b/jstests/ssl/ssl_cert_password.js
@@ -170,4 +170,6 @@ if (!_isWindows()) {
// Stop the server
var exitCode = MongoRunner.stopMongod(md);
assert(exitCode == 0);
+} else {
+ MongoRunner.stopMongod(md);
}
diff --git a/jstests/ssl/ssl_cluster_file.js b/jstests/ssl/ssl_cluster_file.js
index aa77b875530..a7296a3b731 100644
--- a/jstests/ssl/ssl_cluster_file.js
+++ b/jstests/ssl/ssl_cluster_file.js
@@ -31,5 +31,5 @@
0,
mongo,
"Connection attempt failed when an irrelevant sslClusterFile was provided to the server!");
-
+ MongoRunner.stopMongod(mongod);
}());
diff --git a/jstests/ssl/ssl_crl_revoked.js b/jstests/ssl/ssl_crl_revoked.js
index cfe5d03d285..1fe4f558f2a 100644
--- a/jstests/ssl/ssl_crl_revoked.js
+++ b/jstests/ssl/ssl_crl_revoked.js
@@ -22,3 +22,4 @@ var mongo = runMongoProgram("mongo",
// 1 is the exit code for the shell failing to connect, which is what we want
// for a successful test.
assert(mongo == 1);
+MongoRunner.stopMongod(md); \ No newline at end of file
diff --git a/jstests/ssl/ssl_weak.js b/jstests/ssl/ssl_weak.js
index c5ea8a27a6e..90f41f136cb 100644
--- a/jstests/ssl/ssl_weak.js
+++ b/jstests/ssl/ssl_weak.js
@@ -30,7 +30,7 @@ mongo = runMongoProgram("mongo",
// 0 is the exit code for success
assert(mongo == 0);
-
+MongoRunner.stopMongod(md);
// Test that connecting with no client certificate and no --sslAllowConnectionsWithoutCertificates
// fails to connect.
var md2 = MongoRunner.runMongod({
@@ -44,3 +44,4 @@ mongo = runMongoProgram(
// 1 is the exit code for failure
assert(mongo == 1);
+MongoRunner.stopMongod(md2); \ No newline at end of file
diff --git a/jstests/ssl/ssl_with_system_ca.js b/jstests/ssl/ssl_with_system_ca.js
index 194712c98ca..494177f6c3d 100644
--- a/jstests/ssl/ssl_with_system_ca.js
+++ b/jstests/ssl/ssl_with_system_ca.js
@@ -4,6 +4,10 @@
// for details.
((function() {
'use strict';
+ // Do not fail if this test leaves unterminated processes because testWithCerts
+ // is expected to throw before it calls stopMongod.
+ TestData.failIfUnterminatedProcesses = false;
+
const HOST_TYPE = getBuildInfo().buildEnvironment.target_os;
if (HOST_TYPE == "windows") {
@@ -35,6 +39,7 @@
};
assert.throws(function() {
+ // Note: this leaves a running mongod process.
testWithCerts("server.pem", "client.pem");
});
assert.doesNotThrow(function() {
diff --git a/jstests/ssl/upgrade_to_ssl.js b/jstests/ssl/upgrade_to_ssl.js
index f1f8409b2a5..977ef3b4d0e 100644
--- a/jstests/ssl/upgrade_to_ssl.js
+++ b/jstests/ssl/upgrade_to_ssl.js
@@ -47,3 +47,4 @@ assert.eq(3, rstConn3.getDB("test").a.count(), "Error interacting with replSet")
var canConnectSSL = runMongoProgram(
"mongo", "--port", rst.ports[0], "--ssl", "--sslAllowInvalidCertificates", "--eval", ";");
assert.eq(0, canConnectSSL, "SSL Connection attempt failed when it should succeed");
+rst.stopSet(); \ No newline at end of file
diff --git a/jstests/ssl/upgrade_to_x509_ssl.js b/jstests/ssl/upgrade_to_x509_ssl.js
index da8eb099b38..3b641642c4f 100644
--- a/jstests/ssl/upgrade_to_x509_ssl.js
+++ b/jstests/ssl/upgrade_to_x509_ssl.js
@@ -100,3 +100,4 @@ authAllNodes();
var rstConn4 = rst.getPrimary();
rstConn4.getDB("test").a.insert({a: 4, str: "TESTTESTTEST"});
assert.eq(4, rstConn4.getDB("test").a.count(), "Error interacting with replSet");
+rst.stopSet(); \ No newline at end of file
diff --git a/jstests/ssl/x509_client.js b/jstests/ssl/x509_client.js
index ec9b63e6dba..ec65d163a01 100644
--- a/jstests/ssl/x509_client.js
+++ b/jstests/ssl/x509_client.js
@@ -105,3 +105,4 @@ var st = new ShardingTest({
});
authAndTest(new Mongo("localhost:" + st.s0.port));
+st.stop();