summaryrefslogtreecommitdiff
path: root/jstests/sslSpecial
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2014-09-29 11:01:13 -0400
committerSpencer T Brody <spencer@mongodb.com>2014-09-29 12:46:48 -0400
commit4d0e951ae7831638936948b2cfb702842b24f260 (patch)
tree457a51b811a0bc6dd1d9fd76582b8a80c6f6536f /jstests/sslSpecial
parent195113534141890f15b1db931c7dfa5162dc6049 (diff)
downloadmongo-4d0e951ae7831638936948b2cfb702842b24f260.tar.gz
SERVER-15437 wait for replication of users in failing SSL tests
Diffstat (limited to 'jstests/sslSpecial')
-rw-r--r--jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js b/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js
index 32b1b7ad329..72bcc9fc76d 100644
--- a/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js
+++ b/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js
@@ -9,29 +9,33 @@
load("jstests/ssl/libs/ssl_helpers.js");
+function authAllNodes() {
+ for (var n = 0; n < rst.nodes.length; n++) {
+ var status = rst.nodes[n].getDB("admin").auth("root", "pwd");
+ assert.eq(status, 1);
+ }
+};
+
opts = {sslMode:"disabled", clusterAuthMode:"keyFile", keyFile: KEYFILE}
-var rst = new ReplSetTest({ name: 'sslSet', nodes: 3, nodeOptions : opts });
+var NUM_NODES = 3;
+var rst = new ReplSetTest({ name: 'sslSet', nodes: NUM_NODES, nodeOptions : opts });
rst.startSet();
rst.initiate();
// Connect to master and do some basic operations
var rstConn1 = rst.getMaster();
-rstConn1.getDB("admin").createUser({user: "root", pwd: "pwd", roles: ["root"]});
+rstConn1.getDB("admin").createUser({user: "root", pwd: "pwd", roles: ["root"]}, {w: NUM_NODES});
rstConn1.getDB("admin").auth("root", "pwd");
rstConn1.getDB("test").a.insert({a:1, str:"TESTTESTTEST"});
assert.eq(1, rstConn1.getDB("test").a.count(), "Error interacting with replSet");
print("===== UPGRADE disabled,keyFile -> allowSSL,sendKeyfile =====");
-for (var n = 0; n < rst.nodes.length; n++) {
- rst.nodes[n].getDB("admin").auth("root", "pwd");
-}
+authAllNodes();
rst.upgradeSet({sslMode:"allowSSL", sslPEMKeyFile: SERVER_CERT,
sslAllowInvalidCertificates:"",
clusterAuthMode:"sendKeyFile", keyFile: KEYFILE,
sslCAFile: CA_CERT}, "root", "pwd");
-for (var n = 0; n < rst.nodes.length; n++) {
- rst.nodes[n].getDB("admin").auth("root", "pwd");
-}
+authAllNodes();
rst.awaitReplication();
var rstConn2 = rst.getMaster();
@@ -43,9 +47,7 @@ rst.upgradeSet({sslMode:"preferSSL", sslPEMKeyFile: SERVER_CERT,
sslAllowInvalidCertificates:"",
clusterAuthMode:"sendX509", keyFile: KEYFILE,
sslCAFile: CA_CERT}, "root", "pwd");
-for (var n = 0; n < rst.nodes.length; n++) {
- rst.nodes[n].getDB("admin").auth("root", "pwd");
-}
+authAllNodes();
rst.awaitReplication();
var rstConn3 = rst.getMaster();
@@ -63,9 +65,7 @@ rst.upgradeSet({sslMode:"preferSSL", sslPEMKeyFile: SERVER_CERT,
sslAllowInvalidCertificates:"",
clusterAuthMode:"x509", keyFile: KEYFILE,
sslCAFile: CA_CERT}, "root", "pwd");
-for (var n = 0; n < rst.nodes.length; n++) {
- rst.nodes[n].getDB("admin").auth("root", "pwd");
-}
+authAllNodes();
rst.awaitReplication();
var rstConn4 = rst.getMaster();
rstConn4.getDB("test").a.insert({a:4, str:"BEEP BOOP"});