summaryrefslogtreecommitdiff
path: root/jstests/tool
diff options
context:
space:
mode:
authormike o'brien <mpobrien005@gmail.com>2015-04-28 12:37:45 -0400
committerErnie Hershey <ernie.hershey@10gen.com>2015-04-28 13:22:20 -0400
commit3140bfa914859b05ae04f99474b34c73c1fcb019 (patch)
tree7bf47b8f251b5ad177a27f66852acacadc7df0af /jstests/tool
parentca9606547991adffb30fea7c32bcdc82fc80b22e (diff)
downloadmongo-3140bfa914859b05ae04f99474b34c73c1fcb019.tar.gz
SERVER-18239 dumpauth.js should use correct db/collection names
Signed-off-by: Ernie Hershey <ernie.hershey@10gen.com>
Diffstat (limited to 'jstests/tool')
-rw-r--r--jstests/tool/dumpauth.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/jstests/tool/dumpauth.js b/jstests/tool/dumpauth.js
index 58bbfa82e9e..5edfe1e9f52 100644
--- a/jstests/tool/dumpauth.js
+++ b/jstests/tool/dumpauth.js
@@ -1,36 +1,37 @@
// dumpauth.js
// test mongodump with authentication
-baseName = "tool_dumpauth";
var m = MongoRunner.runMongod({auth: "", bind_ip: "127.0.0.1"});
-db = m.getDB( "admin" );
+var dbName = "admin"
+var colName = "testcol"
+db = m.getDB(dbName);
db.createUser({user: "testuser" , pwd: "testuser", roles: jsTest.adminUserRoles});
assert( db.auth( "testuser" , "testuser" ) , "auth failed" );
-t = db[ baseName ];
+t = db[colName];
t.drop();
for(var i = 0; i < 100; i++) {
- t["testcol"].save({ "x": i });
+ t.save({ "x": i });
}
x = runMongoProgram( "mongodump",
- "--db", baseName,
+ "--db", dbName,
"--authenticationDatabase=admin",
"-u", "testuser",
"-p", "testuser",
"-h", "127.0.0.1:"+m.port,
- "--collection", "testcol" );
+ "--collection", colName);
assert.eq(x, 0, "mongodump should succeed with authentication");
// SERVER-5233: mongodump with authentication breaks when using "--out -"
x = runMongoProgram( "mongodump",
- "--db", baseName,
+ "--db", dbName,
"--authenticationDatabase=admin",
"-u", "testuser",
"-p", "testuser",
"-h", "127.0.0.1:"+m.port,
- "--collection", "testcol",
+ "--collection", colName,
"--out", "-" );
assert.eq(x, 0, "mongodump should succeed with authentication while using '--out'");