summaryrefslogtreecommitdiff
path: root/jstests/auth/repl_auth.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/repl_auth.js')
-rw-r--r--jstests/auth/repl_auth.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/jstests/auth/repl_auth.js b/jstests/auth/repl_auth.js
index a5bde8167c9..bafaafd8f7b 100644
--- a/jstests/auth/repl_auth.js
+++ b/jstests/auth/repl_auth.js
@@ -4,8 +4,8 @@
*/
var NUM_NODES = 3;
-var rsTest = new ReplSetTest({ nodes: NUM_NODES });
-rsTest.startSet({ oplogSize: 10, keyFile: 'jstests/libs/key1' });
+var rsTest = new ReplSetTest({nodes: NUM_NODES});
+rsTest.startSet({oplogSize: 10, keyFile: 'jstests/libs/key1'});
rsTest.initiate();
rsTest.awaitSecondaryNodes();
@@ -13,14 +13,14 @@ var setupConn = rsTest.getPrimary();
var admin = setupConn.getDB('admin');
// Setup initial data
-admin.createUser({ user:'admin', pwd: 'password', roles: jsTest.adminUserRoles });
+admin.createUser({user: 'admin', pwd: 'password', roles: jsTest.adminUserRoles});
admin.auth('admin', 'password');
-setupConn.getDB('foo').createUser({ user: 'foo', pwd: 'foopwd', roles: jsTest.basicUserRoles },
- { w: NUM_NODES });
+setupConn.getDB('foo')
+ .createUser({user: 'foo', pwd: 'foopwd', roles: jsTest.basicUserRoles}, {w: NUM_NODES});
setupConn.getDB('foo').logout();
-setupConn.getDB('bar').createUser({ user: 'bar', pwd: 'barpwd', roles: jsTest.basicUserRoles },
- { w: NUM_NODES });
+setupConn.getDB('bar')
+ .createUser({user: 'bar', pwd: 'barpwd', roles: jsTest.basicUserRoles}, {w: NUM_NODES});
setupConn.getDB('bar').logout();
var replConn0 = new Mongo(rsTest.getURL());
@@ -33,16 +33,16 @@ var barDB1 = replConn1.getDB('bar');
fooDB0.auth('foo', 'foopwd');
barDB1.auth('bar', 'barpwd');
-assert.writeOK(fooDB0.user.insert({ x: 1 }, { writeConcern: { w: NUM_NODES }}));
-assert.writeError(barDB0.user.insert({ x: 1 }, { writeConcern: { w: NUM_NODES }}));
+assert.writeOK(fooDB0.user.insert({x: 1}, {writeConcern: {w: NUM_NODES}}));
+assert.writeError(barDB0.user.insert({x: 1}, {writeConcern: {w: NUM_NODES}}));
-assert.writeError(fooDB1.user.insert({ x: 2 }, { writeConcern: { w: NUM_NODES }}));
-assert.writeOK(barDB1.user.insert({ x: 2 }, { writeConcern: { w: NUM_NODES }}));
+assert.writeError(fooDB1.user.insert({x: 2}, {writeConcern: {w: NUM_NODES}}));
+assert.writeOK(barDB1.user.insert({x: 2}, {writeConcern: {w: NUM_NODES}}));
// Make sure replica set connection in the shell is ready.
-_awaitRSHostViaRSMonitor(rsTest.getPrimary().name, { ok: true, ismaster: true }, rsTest.name);
+_awaitRSHostViaRSMonitor(rsTest.getPrimary().name, {ok: true, ismaster: true}, rsTest.name);
rsTest.getSecondaries().forEach(function(sec) {
- _awaitRSHostViaRSMonitor(sec.name, { ok: true, secondary: true }, rsTest.name);
+ _awaitRSHostViaRSMonitor(sec.name, {ok: true, secondary: true}, rsTest.name);
});
// Note: secondary nodes are selected randomly and connections will only be returned to the
@@ -65,4 +65,3 @@ for (var x = 0; x < 20; x++) {
}
rsTest.stopSet();
-