summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-03-22 12:08:21 -0400
committerSpencer T Brody <spencer@mongodb.com>2015-04-06 18:19:21 -0400
commit6ccb82c987a47995fd7d8019d7fd4d1e557478b4 (patch)
tree2542816a69e9faaaff840754b42f0229dc905ccd /jstests/noPassthroughWithMongod
parent7baac52f05a3e0cbdb7168e51836f507eda99dff (diff)
downloadmongo-6ccb82c987a47995fd7d8019d7fd4d1e557478b4.tar.gz
SERVER-17450 Standardize on a single way to start mongod in tests
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r--jstests/noPassthroughWithMongod/clonecollection.js16
-rw-r--r--jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js9
-rw-r--r--jstests/noPassthroughWithMongod/logpath.js8
-rw-r--r--jstests/noPassthroughWithMongod/newcollection2.js3
-rw-r--r--jstests/noPassthroughWithMongod/sharding_migrateBigObject.js24
-rw-r--r--jstests/noPassthroughWithMongod/sharding_rs_arb1.js9
-rw-r--r--jstests/noPassthroughWithMongod/sync6_slow.js4
-rw-r--r--jstests/noPassthroughWithMongod/temp_namespace.js14
-rw-r--r--jstests/noPassthroughWithMongod/testing_only_commands.js4
-rw-r--r--jstests/noPassthroughWithMongod/ttl_repl_maintenance.js14
-rw-r--r--jstests/noPassthroughWithMongod/unix_socket1.js3
11 files changed, 50 insertions, 58 deletions
diff --git a/jstests/noPassthroughWithMongod/clonecollection.js b/jstests/noPassthroughWithMongod/clonecollection.js
index f06ae41bc4d..7b6ae57a020 100644
--- a/jstests/noPassthroughWithMongod/clonecollection.js
+++ b/jstests/noPassthroughWithMongod/clonecollection.js
@@ -1,22 +1,22 @@
// Test cloneCollection command
var baseName = "jstests_clonecollection";
-ports = allocatePorts( 2 );
-
-f = startMongod( "--port", ports[ 0 ], "--dbpath", MongoRunner.dataPath + baseName + "_from", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName );
-t = startMongod( "--port", ports[ 1 ], "--dbpath", MongoRunner.dataPath + baseName + "_to", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName );
+var fromMongod = MongoRunner.runMongod({bind_ip: "127.0.0.1"});
+var toMongod = MongoRunner.runMongod({bind_ip: "127.0.0.1"});
+var f = fromMongod.getDB(baseName);
+var t = toMongod.getDB(baseName);
for( i = 0; i < 1000; ++i ) {
f.a.save( { i: i } );
}
assert.eq( 1000, f.a.find().count() , "A1" );
-assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a" ) );
+assert.commandWorked( t.cloneCollection( "localhost:" + fromMongod.port, "a" ) );
assert.eq( 1000, t.a.find().count() , "A2" );
t.a.drop();
-assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a", { i: { $gte: 10, $lt: 20 } } ) );
+assert.commandWorked( t.cloneCollection( "localhost:" + fromMongod.port, "a", { i: { $gte: 10, $lt: 20 } } ) );
assert.eq( 10, t.a.find().count() , "A3" );
t.a.drop();
@@ -24,7 +24,7 @@ assert.eq( 0, t.a.getIndexes().length, "prep 2");
f.a.ensureIndex( { i: 1 } );
assert.eq( 2, f.a.getIndexes().length, "expected index missing" );
-assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a" ) );
+assert.commandWorked( t.cloneCollection( "localhost:" + fromMongod.port, "a" ) );
if ( t.a.getIndexes().length != 2 ) {
printjson( t.a.getIndexes());
}
@@ -41,7 +41,7 @@ t.a.drop();
f.createCollection( "a", {capped:true,size:1000} );
assert( f.a.isCapped() );
-assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a" ) );
+assert.commandWorked( t.cloneCollection( "localhost:" + fromMongod.port, "a" ) );
assert( t.a.isCapped(), "cloned collection not capped" );
diff --git a/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js b/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js
index 7e7e32a71b0..c4896e56406 100644
--- a/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js
+++ b/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js
@@ -9,17 +9,12 @@ if ("undefined" == typeof inner_mode) {
// Start a mongod with --ipv6
port = allocatePorts( 1 )[ 0 ];
- var baseName = "jstests_slowNightly_ipv6_connection_string_validation";
jsTest.log("Outer mode test starting mongod with --ipv6");
// NOTE: bind_ip arg is present to test if it can parse ipv6 addresses (::1 in this case).
// Unfortunately, having bind_ip = ::1 won't work in the test framework (But does work when
// tested manually), so 127.0.0.1 is also present so the test mongo shell can connect
// with that address.
- var mongod = startMongod("--port", port,
- "--ipv6",
- "--bind_ip", "::1,127.0.0.1",
- "--dbpath",
- MongoRunner.dataPath + baseName );
+ var mongod = MongoRunner.runMongod({port: port, ipv6: "", bind_ip: "::1,127.0.0.1"});
var args = ["mongo",
"--nodb",
"--ipv6",
@@ -32,7 +27,7 @@ if ("undefined" == typeof inner_mode) {
// Stop the server we started
jsTest.log("Outer mode test stopping server");
- stopMongod(port, 15);
+ MongoRunner.stopMongod(port, 15);
// Pass the inner test's exit code back as the outer test's exit code
quit(exitCode);
diff --git a/jstests/noPassthroughWithMongod/logpath.js b/jstests/noPassthroughWithMongod/logpath.js
index 78be510f0a2..5f2b809d6df 100644
--- a/jstests/noPassthroughWithMongod/logpath.js
+++ b/jstests/noPassthroughWithMongod/logpath.js
@@ -57,7 +57,7 @@ var m = MongoRunner.runMongod({ port: port[0], dbpath: dbdir, logpath: logdir +
// log should now exist (and no rotations should exist)
assert.eq(logCount(logs[0], true), 1);
-stopMongod(port[0]);
+MongoRunner.stopMongod(port[0]);
print("------ Start mongod with logpath set to existing file");
m = MongoRunner.runMongod({ port: port[1], dbpath: dbdir, logpath: logdir + logs[0]});
@@ -69,7 +69,7 @@ assert.eq(logCount(logs[0]), 1);
assert.eq(logCount(logs[0], true), 2);
cleanupFiles();
-stopMongod(port[1]);
+MongoRunner.stopMongod(port[1]);
// Blocking on SERVER-5117:
// MongoRunner currently hangs if mongod fails to start so these tests don't work
@@ -84,7 +84,7 @@ if ( false ) {
// log should now exist (and no rotations should exist)
assert.eq(logCount(logs[1], true), 1);
- stopMongod(port[2]);
+ MongoRunner.stopMongod(port[2]);
print("------ Start mongod with logpath set to existing file, fork");
m = MongoRunner.runMongod({ port: port[3], dbpath: dbdir, logpath: logdir + logs[1], fork: true});
@@ -96,7 +96,7 @@ if ( false ) {
assert.eq(logCount(logs[1], true), 2);
cleanupFiles();
- stopMongod(port[3]);
+ MongoRunner.stopMongod(port[3]);
}
// the following tests depend on undefined behavior; assume that MongoRunner raises exception on error
diff --git a/jstests/noPassthroughWithMongod/newcollection2.js b/jstests/noPassthroughWithMongod/newcollection2.js
index 0a2b5148260..86d5e9f7a3a 100644
--- a/jstests/noPassthroughWithMongod/newcollection2.js
+++ b/jstests/noPassthroughWithMongod/newcollection2.js
@@ -1,8 +1,7 @@
// Alocate collection forcing just a small size remainder in 2nd extent
-port = allocatePorts( 1 )[ 0 ]
var baseName = "jstests_disk_newcollection2";
-var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", MongoRunner.dataPath + baseName );
+var m = MongoRunner.runMongod({noprealloc: "", smallfiles: ""});
db = m.getDB( "test" );
db.createCollection( baseName, {size:0x1FFC0000-0x10-8192} );
diff --git a/jstests/noPassthroughWithMongod/sharding_migrateBigObject.js b/jstests/noPassthroughWithMongod/sharding_migrateBigObject.js
index 32278c089f3..3546e53f4c0 100644
--- a/jstests/noPassthroughWithMongod/sharding_migrateBigObject.js
+++ b/jstests/noPassthroughWithMongod/sharding_migrateBigObject.js
@@ -1,14 +1,12 @@
+var shardA = MongoRunner.runMongod({shardsvr: "", nopreallocj: ""});
+var shardB = MongoRunner.runMongod({shardsvr: "", nopreallocj: ""});
+var config = MongoRunner.runMongod({configsvr: "", nopreallocj: ""});
+var mongos = MongoRunner.runMongos({configdb : "localhost:" + config.port });
-var shardA = startMongodEmpty("--shardsvr", "--port", 30001, "--dbpath", MongoRunner.dataDir + "/migrateBigger0", "--nopreallocj");
-var shardB = startMongodEmpty("--shardsvr", "--port", 30002, "--dbpath", MongoRunner.dataDir + "/migrateBigger1", "--nopreallocj");
-var config = startMongodEmpty("--configsvr", "--port", 29999, "--dbpath", MongoRunner.dataDir + "/migrateBiggerC", "--nopreallocj");
+var admin = mongos.getDB("admin");
-var mongos = startMongos({ port : 30000, configdb : "localhost:29999" })
-
-var admin = mongos.getDB("admin")
-
-admin.runCommand({ addshard : "localhost:30001" })
-admin.runCommand({ addshard : "localhost:30002" })
+admin.runCommand({ addshard : "localhost:" + shardA.port });
+admin.runCommand({ addshard : "localhost:" + shardB.port });
db = mongos.getDB("test");
var coll = db.getCollection("stuff")
@@ -67,9 +65,9 @@ assert.soon(
} ,
"never migrated" , 10 * 60 * 1000 , 1000 );
-stopMongod( 30000 );
-stopMongod( 29999 );
-stopMongod( 30001 );
-stopMongod( 30002 );
+MongoRunner.stopMongos(mongos);
+MongoRunner.stopMongod(config);
+MongoRunner.stopMongod(shardA);
+MongoRunner.stopMongod(shardB);
diff --git a/jstests/noPassthroughWithMongod/sharding_rs_arb1.js b/jstests/noPassthroughWithMongod/sharding_rs_arb1.js
index 0e51180b44d..7096b31ad0f 100644
--- a/jstests/noPassthroughWithMongod/sharding_rs_arb1.js
+++ b/jstests/noPassthroughWithMongod/sharding_rs_arb1.js
@@ -17,9 +17,9 @@ master = replTest.getMaster();
db = master.getDB( "test" );
printjson( rs.status() );
-var config = startMongodEmpty("--configsvr", "--port", 29999, "--dbpath", MongoRunner.dataPath + name + "_config" );
+var config = MongoRunner.runMongod({configsvr: ""});
-var mongos = startMongos({ port : 30000, configdb : getHostName() + ":29999" })
+var mongos = MongoRunner.runMongos({configdb : getHostName() + ":" + config.port });
var admin = mongos.getDB("admin")
var url = name + "/";
for ( i=0; i<port.length; i++ ) {
@@ -33,8 +33,7 @@ printjson( res )
assert( res.ok , tojson(res) )
-
-stopMongod( 30000 )
-stopMongod( 29999 )
+MongoRunner.stopMongos(mongos);
+MongoRunner.stopMongod(config);
replTest.stopSet();
diff --git a/jstests/noPassthroughWithMongod/sync6_slow.js b/jstests/noPassthroughWithMongod/sync6_slow.js
index d253478e1da..98e52f468a0 100644
--- a/jstests/noPassthroughWithMongod/sync6_slow.js
+++ b/jstests/noPassthroughWithMongod/sync6_slow.js
@@ -11,7 +11,7 @@ var test = new SyncCCTest("sync6", {logpath: bitbucket, logappend: ""});
// Startup another process to handle our commands to the cluster, mostly so it's
// easier to read.
-var commandConn = startMongodTest( 30000 + 4, "syncCommander", false, {});
+var commandConn = MongoRunner.runMongod({});
// Up the log level for this test
commandConn.getDB( "admin" ).runCommand( { setParameter : 1, logLevel : 0 } );
@@ -79,5 +79,5 @@ for ( var i = 4; i < 5; i++ ) {
}
}
-stopMongoProgram( 30004 );
+MongoRunner.stopMongod(commandConn);
test.stop();
diff --git a/jstests/noPassthroughWithMongod/temp_namespace.js b/jstests/noPassthroughWithMongod/temp_namespace.js
index 123ad07270b..108c5871c7a 100644
--- a/jstests/noPassthroughWithMongod/temp_namespace.js
+++ b/jstests/noPassthroughWithMongod/temp_namespace.js
@@ -1,9 +1,8 @@
// this is to make sure that temp collections get cleaned up on restart
testname = 'temp_namespace_sw'
-path = MongoRunner.dataPath+testname
-conn = startMongodEmpty("--port", 30000, "--dbpath", path, "--smallfiles", "--noprealloc", "--nopreallocj");
+var conn = MongoRunner.runMongod({smallfiles: "", noprealloc: "", nopreallocj: ""});
d = conn.getDB('test')
d.runCommand({create: testname+'temp1', temp: true});
d[testname+'temp1'].ensureIndex({x:1});
@@ -21,10 +20,15 @@ function countCollectionNames( theDB, regex ) {
assert.eq(countCollectionNames( d, /temp\d$/) , 2)
assert.eq(countCollectionNames( d, /keep\d$/) , 4)
-stopMongod(30000);
+MongoRunner.stopMongod(conn);
-conn = startMongodNoReset("--port", 30000, "--dbpath", path, "--smallfiles", "--noprealloc", "--nopreallocj");
+conn = MongoRunner.runMongod({restart:true,
+ cleanData: false,
+ dbpath: conn.dbpath,
+ smallfiles: "",
+ noprealloc: "",
+ nopreallocj: ""});
d = conn.getDB('test')
assert.eq(countCollectionNames( d, /temp\d$/) , 0)
assert.eq(countCollectionNames( d, /keep\d$/) , 4)
-stopMongod(30000);
+MongoRunner.stopMongod(conn);
diff --git a/jstests/noPassthroughWithMongod/testing_only_commands.js b/jstests/noPassthroughWithMongod/testing_only_commands.js
index 11f4cca503e..a23ac3a7c4c 100644
--- a/jstests/noPassthroughWithMongod/testing_only_commands.js
+++ b/jstests/noPassthroughWithMongod/testing_only_commands.js
@@ -32,7 +32,7 @@ var assertCmdFound = function(db, cmdName) {
jsTest.setOption('enableTestCommands', false);
-var conn = startMongodTest();
+var conn = MongoRunner.runMongod({});
for (i in testOnlyCommands) {
assertCmdNotFound(conn.getDB('test'), testOnlyCommands[i]);
}
@@ -41,7 +41,7 @@ MongoRunner.stopMongod(conn.port);
// Now enable the commands
jsTest.setOption('enableTestCommands', true);
-var conn = startMongodTest();
+var conn = MongoRunner.runMongod({});
for (i in testOnlyCommands) {
assertCmdFound(conn.getDB('test'), testOnlyCommands[i]);
}
diff --git a/jstests/noPassthroughWithMongod/ttl_repl_maintenance.js b/jstests/noPassthroughWithMongod/ttl_repl_maintenance.js
index 852007b4300..300b57f906d 100644
--- a/jstests/noPassthroughWithMongod/ttl_repl_maintenance.js
+++ b/jstests/noPassthroughWithMongod/ttl_repl_maintenance.js
@@ -9,9 +9,7 @@ var runner;
var conn;
var primeSystemReplset = function() {
- var port = allocatePorts(1)[0];
- runner = new MongodRunner(port, MongoRunner.dataDir + "/jstests_slowNightly-ttl");
- conn = runner.start();
+ conn = MongoRunner.runMongod();
var localDB = conn.getDB("local");
localDB.system.replset.insert({x:1});
@@ -21,8 +19,8 @@ var primeSystemReplset = function() {
};
var restartWithConfig = function() {
- stopMongod(runner.port(), 15);
- conn = runner.start(true /* reuse data */);
+ MongoRunner.stopMongod(conn.port, 15);
+ conn = MongoRunner.runMongod({restart:true, cleanData: false, dbpath: conn.dbpath});
testDB = conn.getDB("test");
var n = 100;
for (var i=0; i<n; i++) {
@@ -39,15 +37,15 @@ var restartWithoutConfig = function() {
var localDB = conn.getDB("local");
assert.writeOK(localDB.system.replset.remove({}));
- stopMongod(runner.port(), 15);
+ MongoRunner.stopMongod(conn.port, 15);
- conn = runner.start(true /* reuse data */);
+ conn = MongoRunner.runMongod({restart:true, cleanData: false, dbpath: conn.dbpath});
assert.soon(function() {
return conn.getDB("test").foo.count() < 100;
}, "never deleted", 65000);
- stopMongod(runner.port(), 15);
+ MongoRunner.stopMongod(conn.port, 15);
};
print("Create a TTL collection and put doc in local.system.replset");
diff --git a/jstests/noPassthroughWithMongod/unix_socket1.js b/jstests/noPassthroughWithMongod/unix_socket1.js
index 8f254e88126..8e28715558c 100644
--- a/jstests/noPassthroughWithMongod/unix_socket1.js
+++ b/jstests/noPassthroughWithMongod/unix_socket1.js
@@ -28,8 +28,7 @@ if ( ! _isWindows() ) {
mkdir(path);
var dataPath = MongoRunner.dataDir + "/sockpath_data";
- var conn = new MongodRunner(ports[0], dataPath, null, null, ["--unixSocketPrefix", path]);
- conn.start();
+ var conn = MongoRunner.runMongod({port: ports[0], dbpath: dataPath, unixSocketPrefix: path});
var sock2 = new Mongo(path+"/mongodb-"+ports[0]+".sock");
sockdb2 = sock2.getDB(db.getName())