summaryrefslogtreecommitdiff
path: root/jstests/replsets/auth1.js
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2016-08-11 20:50:01 -0400
committerEsha Maharishi <esha.maharishi@mongodb.com>2016-08-11 21:07:39 -0400
commitd1223a8ad44d6bc91766f0bd05a08820cdb1fdea (patch)
treecbf51e562e432452193d238abd9f13c84db4ebf4 /jstests/replsets/auth1.js
parent6c6bf0284642a7fe1138888d6c3044a6f4912468 (diff)
downloadmongo-d1223a8ad44d6bc91766f0bd05a08820cdb1fdea.tar.gz
SERVER-22663 Make --shardsvr required for a mongod to be used as a shard
Diffstat (limited to 'jstests/replsets/auth1.js')
-rw-r--r--jstests/replsets/auth1.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/jstests/replsets/auth1.js b/jstests/replsets/auth1.js
index 23054b9c38d..69bba87a81d 100644
--- a/jstests/replsets/auth1.js
+++ b/jstests/replsets/auth1.js
@@ -42,6 +42,8 @@ load("jstests/replsets/rslib.js");
m, _isWindows() ? 100 : 1, "mongod should exit w/ 1 (EXIT_FAILURE): permissions too open");
MongoRunner.stopMongod(port[0]);
+ // Pre-populate the data directory for the first replica set node, to be started later, with
+ // a user's credentials.
print("add a user to server0: foo");
m = MongoRunner.runMongod({dbpath: MongoRunner.dataPath + name + "-0"});
m.getDB("admin").createUser({user: "foo", pwd: "bar", roles: jsTest.adminUserRoles});
@@ -51,11 +53,13 @@ load("jstests/replsets/rslib.js");
print("start up rs");
var rs = new ReplSetTest({"name": name, "nodes": 3});
- print("restart 0 with keyFile");
+
+ // The first node is started with the pre-populated data directory.
+ print("start 0 with keyFile");
m = rs.start(0, {"keyFile": key1_600, noCleanData: true});
- print("restart 1 with keyFile");
+ print("start 1 with keyFile");
rs.start(1, {"keyFile": key1_600});
- print("restart 2 with keyFile");
+ print("start 2 with keyFile");
rs.start(2, {"keyFile": key1_600});
var result = m.getDB("admin").auth("foo", "bar");