summaryrefslogtreecommitdiff
path: root/jstests/auth/copyauth2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/copyauth2.js')
-rw-r--r--jstests/auth/copyauth2.js25
1 files changed, 12 insertions, 13 deletions
diff --git a/jstests/auth/copyauth2.js b/jstests/auth/copyauth2.js
index 852ba40e641..f47bfcba8ad 100644
--- a/jstests/auth/copyauth2.js
+++ b/jstests/auth/copyauth2.js
@@ -1,26 +1,25 @@
// Basic test that copydb works with auth enabled when copying within the same cluster
function runTest(a, b) {
- a.createUser({user: "chevy", pwd: "chase", roles: ["read", {role:'readWrite', db: b._name}]});
- a.foo.insert({a:1});
- b.getSiblingDB( "admin").logout();
+ a.createUser({user: "chevy", pwd: "chase", roles: ["read", {role: 'readWrite', db: b._name}]});
+ a.foo.insert({a: 1});
+ b.getSiblingDB("admin").logout();
a.auth("chevy", "chase");
- assert.eq( 1 , a.foo.count() , "A" );
- assert.eq( 0 , b.foo.count() , "B" );
+ assert.eq(1, a.foo.count(), "A");
+ assert.eq(0, b.foo.count(), "B");
- a.copyDatabase(a._name , b._name);
- assert.eq( 1 , a.foo.count() , "C" );
- assert.eq( 1 , b.foo.count() , "D" );
+ a.copyDatabase(a._name, b._name);
+ assert.eq(1, a.foo.count(), "C");
+ assert.eq(1, b.foo.count(), "D");
}
-
// run all tests standalone
-var conn = MongoRunner.runMongod({auth:""});
-var a = conn.getDB( "copydb2-test-a" );
-var b = conn.getDB( "copydb2-test-b" );
-var adminDB = conn.getDB( "admin" );
+var conn = MongoRunner.runMongod({auth: ""});
+var a = conn.getDB("copydb2-test-a");
+var b = conn.getDB("copydb2-test-b");
+var adminDB = conn.getDB("admin");
adminDB.createUser({user: "root", pwd: "root", roles: ["root"]});
adminDB.auth("root", "root");
runTest(a, b);