diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2015-09-01 16:19:57 -0400 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2015-09-09 13:14:48 -0400 |
commit | c15f4bb96d2ee86874582d45d1865e9358168e7e (patch) | |
tree | 92c788863ae91a8b9c5801e1d536d7ef1a02ec05 /jstests/auth/server-4892.js | |
parent | f5e063d4785b0460ab41de8cc4b537e5e2151338 (diff) | |
download | mongo-c15f4bb96d2ee86874582d45d1865e9358168e7e.tar.gz |
SERVER-18272 Update jstests to use allocatePort() instead of hard coding ports
Diffstat (limited to 'jstests/auth/server-4892.js')
-rw-r--r-- | jstests/auth/server-4892.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/jstests/auth/server-4892.js b/jstests/auth/server-4892.js index 12fc0d8c067..3053fcab4dc 100644 --- a/jstests/auth/server-4892.js +++ b/jstests/auth/server-4892.js @@ -7,24 +7,25 @@ var baseName = 'jstests_auth_server4892'; var dbpath = MongoRunner.dataPath + baseName; -var port = allocatePorts( 1 )[ 0 ]; -var mongod_common_args = [ - '--port', port, '--dbpath', dbpath, '--bind_ip', '127.0.0.1', '--nohttpinterface' ]; +resetDbpath(dbpath); +var mongodCommonArgs = { + dbpath: dbpath, + noCleanData: true, +}; /* * Start an instance of mongod, pass it as a parameter to operation(), then stop the instance of * mongod before unwinding or returning out of with_mongod(). * - * extra_mongod_args are extra arguments to pass on the mongod command line, in an Array. + * 'extraMongodArgs' are extra arguments to pass on the mongod command line, as an object. */ -function with_mongod( extra_mongod_args, operation ) { - var mongod = startMongoProgram.apply( - null, ['mongod'].concat( mongod_common_args, extra_mongod_args ) ); +function withMongod(extraMongodArgs, operation) { + var mongod = MongoRunner.runMongod(Object.merge(mongodCommonArgs, extraMongodArgs)); try { operation( mongod ); } finally { - MongoRunner.stopMongod( port ); + MongoRunner.stopMongod( mongod.port ); } } @@ -42,9 +43,7 @@ function expectNumLiveCursors(mongod, expectedNumLiveCursors) { + expectedNumLiveCursors + ")"); } -resetDbpath( dbpath ); - -with_mongod( ['--noauth'], function setupTest( mongod ) { +withMongod({noauth: ""}, function setupTest(mongod) { var admin, somedb, conn; conn = new Mongo( mongod.host ); admin = conn.getDB( 'admin' ); @@ -59,7 +58,7 @@ with_mongod( ['--noauth'], function setupTest( mongod ) { admin.logout(); } ); -with_mongod( ['--auth'], function runTest( mongod ) { +withMongod({auth: ""}, function runTest(mongod) { var conn = new Mongo( mongod.host ); var somedb = conn.getDB( 'somedb' ); somedb.auth('frim', 'fram'); |