summaryrefslogtreecommitdiff
path: root/jstests/replsets/auth2.js
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2017-09-27 23:23:24 -0400
committerMisha Tyulenev <misha@mongodb.com>2017-09-27 23:23:46 -0400
commiteeee1e2b64f70e8487f017ba579f3ca861c81e4f (patch)
treee1452828e142748f1f03be61a00c32dbb3ed6bc1 /jstests/replsets/auth2.js
parent55637833c707998f685f997d43624c52cde99b45 (diff)
downloadmongo-eeee1e2b64f70e8487f017ba579f3ca861c81e4f.tar.gz
SERVER-30977 add clusterTime to standalone replica set
Diffstat (limited to 'jstests/replsets/auth2.js')
-rw-r--r--jstests/replsets/auth2.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/jstests/replsets/auth2.js b/jstests/replsets/auth2.js
index 6169aa55b67..529dd5257c7 100644
--- a/jstests/replsets/auth2.js
+++ b/jstests/replsets/auth2.js
@@ -4,20 +4,20 @@
// @tags: [requires_persistence]
(function() {
- var testInvalidAuthStates = function(replSetTest) {
+ var testInvalidAuthStates = function(replSetTest, expectedState) {
print("check that 0 is in recovering");
- replSetTest.waitForState(replSetTest.nodes[0], ReplSetTest.State.RECOVERING);
+ replSetTest.waitForState(replSetTest.nodes[0], expectedState);
print("shut down 1, 0 still in recovering.");
replSetTest.stop(1);
sleep(5);
- replSetTest.waitForState(replSetTest.nodes[0], ReplSetTest.State.RECOVERING);
+ replSetTest.waitForState(replSetTest.nodes[0], expectedState);
print("shut down 2, 0 becomes a secondary.");
replSetTest.stop(2);
- replSetTest.waitForState(replSetTest.nodes[0], ReplSetTest.State.SECONDARY);
+ replSetTest.waitForState(replSetTest.nodes[0], expectedState);
replSetTest.restart(1, {"keyFile": key1});
replSetTest.restart(2, {"keyFile": key1});
@@ -30,7 +30,7 @@
var key1 = path + "key1";
var key2 = path + "key2";
- var replSetTest = new ReplSetTest({name: name, nodes: 3});
+ var replSetTest = new ReplSetTest({name: name, nodes: 3, waitForKeys: true});
var nodes = replSetTest.startSet();
var hostnames = replSetTest.nodeList();
replSetTest.initiate({
@@ -58,7 +58,7 @@
// auth to all nodes with auth
replSetTest.nodes[1].getDB("admin").auth("foo", "bar");
replSetTest.nodes[2].getDB("admin").auth("foo", "bar");
- testInvalidAuthStates(replSetTest);
+ testInvalidAuthStates(replSetTest, ReplSetTest.State.RECOVERING);
print("restart mongod with bad keyFile");
@@ -69,12 +69,10 @@
replSetTest.nodes[0].getDB("admin").auth("foo", "bar");
replSetTest.nodes[1].getDB("admin").auth("foo", "bar");
replSetTest.nodes[2].getDB("admin").auth("foo", "bar");
- testInvalidAuthStates(replSetTest);
+ testInvalidAuthStates(replSetTest, ReplSetTest.State.RECOVERING);
replSetTest.stop(0);
m = replSetTest.restart(0, {"keyFile": key1});
- print("0 becomes a secondary");
-
replSetTest.stopSet();
-}()); \ No newline at end of file
+}());