diff options
author | mike o'brien <mpobrien005@gmail.com> | 2015-04-28 12:37:45 -0400 |
---|---|---|
committer | Ramon Fernandez <ramon.fernandez@mongodb.com> | 2015-04-28 15:44:33 -0400 |
commit | 5a1b51c847f9e4c466cecbbff0ac726152a69ee7 (patch) | |
tree | 061957e8b68820ff561f1aeaaa476f1b85b5bf73 | |
parent | 73d9eb5a4407a4b7724cadb2b5dd778a97a4d207 (diff) | |
download | mongo-5a1b51c847f9e4c466cecbbff0ac726152a69ee7.tar.gz |
SERVER-18239 dumpauth.js should use correct db/collection names
Signed-off-by: Ernie Hershey <ernie.hershey@10gen.com>
(cherry picked from commit 3140bfa914859b05ae04f99474b34c73c1fcb019)
Conflicts:
jstests/tool/dumpauth.js
-rw-r--r-- | jstests/tool/dumpauth.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/jstests/tool/dumpauth.js b/jstests/tool/dumpauth.js index 7ae165f5ce1..5edfe1e9f52 100644 --- a/jstests/tool/dumpauth.js +++ b/jstests/tool/dumpauth.js @@ -1,37 +1,37 @@ // dumpauth.js // test mongodump with authentication -port = allocatePorts( 1 )[ 0 ]; -baseName = "tool_dumpauth"; -m = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); -db = m.getDB( "admin" ); +var m = MongoRunner.runMongod({auth: "", bind_ip: "127.0.0.1"}); +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:"+port, - "--collection", "testcol" ); + "-h", "127.0.0.1:"+m.port, + "--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:"+port, - "--collection", "testcol", + "-h", "127.0.0.1:"+m.port, + "--collection", colName, "--out", "-" ); assert.eq(x, 0, "mongodump should succeed with authentication while using '--out'"); |