diff options
author | mike o'brien <mpobrien005@gmail.com> | 2015-04-28 12:37:45 -0400 |
---|---|---|
committer | Ernie Hershey <ernie.hershey@10gen.com> | 2015-04-28 13:22:20 -0400 |
commit | 3140bfa914859b05ae04f99474b34c73c1fcb019 (patch) | |
tree | 7bf47b8f251b5ad177a27f66852acacadc7df0af /jstests/tool | |
parent | ca9606547991adffb30fea7c32bcdc82fc80b22e (diff) | |
download | mongo-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.js | 17 |
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'"); |