diff options
author | Spencer T Brody <spencer@mongodb.com> | 2015-03-22 12:08:21 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2015-04-06 18:19:21 -0400 |
commit | 6ccb82c987a47995fd7d8019d7fd4d1e557478b4 (patch) | |
tree | 2542816a69e9faaaff840754b42f0229dc905ccd /jstests/dur | |
parent | 7baac52f05a3e0cbdb7168e51836f507eda99dff (diff) | |
download | mongo-6ccb82c987a47995fd7d8019d7fd4d1e557478b4.tar.gz |
SERVER-17450 Standardize on a single way to start mongod in tests
Diffstat (limited to 'jstests/dur')
-rwxr-xr-x | jstests/dur/a_quick.js | 12 | ||||
-rw-r--r-- | jstests/dur/checksum.js | 21 | ||||
-rw-r--r-- | jstests/dur/closeall.js | 18 | ||||
-rw-r--r-- | jstests/dur/diskfull.js | 8 | ||||
-rw-r--r-- | jstests/dur/dropdb.js | 12 | ||||
-rwxr-xr-x | jstests/dur/dur1.js | 17 | ||||
-rwxr-xr-x | jstests/dur/dur1_tool.js | 21 | ||||
-rw-r--r-- | jstests/dur/dur2.js | 22 | ||||
-rw-r--r-- | jstests/dur/dur_jscore_passthrough.js | 5 | ||||
-rw-r--r-- | jstests/dur/indexbg.js | 2 | ||||
-rw-r--r-- | jstests/dur/indexbg2.js | 2 | ||||
-rwxr-xr-x | jstests/dur/lsn.js | 23 | ||||
-rwxr-xr-x | jstests/dur/manyRestart.js | 28 | ||||
-rwxr-xr-x | jstests/dur/oplog.js | 24 |
14 files changed, 133 insertions, 82 deletions
diff --git a/jstests/dur/a_quick.js b/jstests/dur/a_quick.js index bbec8af6939..937b0b71bf4 100755 --- a/jstests/dur/a_quick.js +++ b/jstests/dur/a_quick.js @@ -59,16 +59,16 @@ var path2 = MongoRunner.dataDir + "/quickdur"; // non-durable version tst.log("start mongod without dur"); -var conn = startMongodEmpty("--port", 30000, "--dbpath", path1, "--nodur"); +var conn = MongoRunner.runMongod({dbpath: path1, nodur: ""}); tst.log("without dur work"); var d = conn.getDB("test"); assert.writeOK(d.foo.insert({ _id: 123 })); tst.log("stop without dur"); -stopMongod(30000); +MongoRunner.stopMongod(conn); // durable version tst.log("start mongod with dur"); -conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--dur", "--durOptions", 8); +conn = MongoRunner.runMongod({dbpath: path2, dur: "", durOptions: 8}); tst.log("with dur work"); d = conn.getDB("test"); assert.writeOK(d.foo.insert({ _id: 123 })); @@ -81,7 +81,7 @@ sleep(8000); // kill the process hard tst.log("kill -9 mongod"); -stopMongod(30001, /*signal*/9); +MongoRunner.stopMongod(conn.port, /*signal*/9); // journal file should be present, and non-empty as we killed hard @@ -104,7 +104,7 @@ if (files.some(function (f) { return f.name.indexOf("lsn") >= 0; })) { // restart and recover tst.log("restart and recover"); -conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--dur", "--durOptions", 9); +conn = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: path2, dur: "", durOptions: 9}); tst.log("check data results");
d = conn.getDB("test");
@@ -115,7 +115,7 @@ if (!countOk) { } tst.log("stop"); -stopMongod(30002); +MongoRunner.stopMongod(conn); // at this point, after clean shutdown, there should be no journal files tst.log("check no journal files"); diff --git a/jstests/dur/checksum.js b/jstests/dur/checksum.js index 1270e337a87..ed4abf31147 100644 --- a/jstests/dur/checksum.js +++ b/jstests/dur/checksum.js @@ -6,7 +6,7 @@ var path = MongoRunner.dataPath + testname; if (0) { // This is used to create the prototype journal file. jsTest.log("Just creating prototype journal, not testing anything"); - var conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur"); + var conn = MongoRunner.runMongod({dbpath: path, dur: ""}); var db = conn.getDB("test"); // each insert is in it's own commit. @@ -16,7 +16,7 @@ if (0) { db.foo.insert({a: 2}); db.runCommand({getlasterror:1, j:1}) - stopMongod(30001, /*signal*/9); + MongoRunner.stopMongod(conn.port, /*signal*/9); jsTest.log("Journal file left at " + path + "/journal/j._0"); quit(); @@ -25,11 +25,12 @@ if (0) { } function startMongodWithJournal() { - return startMongodNoReset("--port", 30001, - "--dbpath", path, - "--dur", - "--smallfiles", - "--durOptions", 1 /*DurDumpJournal*/); + return MongoRunner.runMongod({restart: true, + cleanData: false, + dbpath: path, + dur: "", + smallfiles: "", + durOptions: 1 /*DurDumpJournal*/}); } @@ -40,7 +41,7 @@ copyFile("jstests/libs/dur_checksum_good.journal", path + "/journal/j._0"); var conn = startMongodWithJournal(); var db = conn.getDB('test'); assert.eq(db.foo.count(), 2); -stopMongod(30001); +MongoRunner.stopMongod(conn.port); // dur_checksum_bad_last.journal is good.journal with the bad checksum on the last section. @@ -51,7 +52,7 @@ copyFile("jstests/libs/dur_checksum_bad_last.journal", path + "/journal/j._0"); conn = startMongodWithJournal(); var db = conn.getDB('test'); assert.eq(db.foo.count(), 1); // 2nd insert "never happened" -stopMongod(30001); +MongoRunner.stopMongod(conn.port); // dur_checksum_bad_first.journal is good.journal with the bad checksum on the prior section. @@ -64,7 +65,7 @@ copyFile("jstests/libs/dur_checksum_bad_first.journal", path + "/journal/j._0"); conn = startMongodWithJournal(); var db = conn.getDB('test'); assert.eq(db.foo.count(), 0); // Neither insert happened. -stopMongod(30001); +MongoRunner.stopMongod(conn.port); // If we detect an error in a non-final journal file, that is considered an error. jsTest.log("Starting with bad_last.journal followed by good.journal"); diff --git a/jstests/dur/closeall.js b/jstests/dur/closeall.js index 00b4fff1c3c..6dc301e9ae2 100644 --- a/jstests/dur/closeall.js +++ b/jstests/dur/closeall.js @@ -2,8 +2,6 @@ // this is also a test of saveState() as that will get exercised by the update function f(variant, quickCommits, paranoid) { - var path = MongoRunner.dataDir + "/closeall"; - var path2 = MongoRunner.dataDir + "/closeall_slave"; var ourdb = "closealltest"; print("closeall.js start mongod variant:" + variant + "." + quickCommits + "." + paranoid); @@ -14,8 +12,14 @@ function f(variant, quickCommits, paranoid) { N = 300; // use replication to exercise that code too with a close, and also to test local.sources with a close - var conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur", "--durOptions", options, "--master", "--oplogSize", 64); - var connSlave = startMongodEmpty("--port", 30002, "--dbpath", path2, "--dur", "--durOptions", options, "--slave", "--source", "localhost:30001"); + var conn = MongoRunner.runMongod({dur: "", + durOptions: options + "", + master: "", + oplogSize: 64}); + var connSlave = MongoRunner.runMongod({dur: "", + durOptions: options + "", + slave: "", + source: "localhost:" + conn.port}); var slave = connSlave.getDB(ourdb); @@ -45,7 +49,7 @@ function f(variant, quickCommits, paranoid) { { a: 1, b: 2, c: 3, d: 4 }); \ if( i == 800 ) \ coll.ensureIndex({ x: 1 }); \ - }', 30001); + }', conn.port); for( var i = 0; i < N; i++ ) { var res = null; @@ -80,8 +84,8 @@ function f(variant, quickCommits, paranoid) { print(slave.foo.count()); print("closeall.js shutting down servers"); - stopMongod(30002); - stopMongod(30001); + MongoRunner.stopMongod(connSlave); + MongoRunner.stopMongod(conn); writeOps(); } diff --git a/jstests/dur/diskfull.js b/jstests/dur/diskfull.js index 6fb38a15d1b..5d3b0da8906 100644 --- a/jstests/dur/diskfull.js +++ b/jstests/dur/diskfull.js @@ -94,10 +94,10 @@ function runFirstMongodAndFillDisk() { log(); clear(); - conn = startMongodNoReset("--port", 30001, "--dbpath", startPath, "--dur", "--smallfiles", "--durOptions", 8+64, "--noprealloc"); + conn = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: startPath, dur: "", smallfiles: "", durOptions: 8+64, noprealloc: ""}); assert.throws( work, null, "no exception thrown when exceeding disk capacity" ); - stopMongod( 30001 ); + MongoRunner.stopMongod(conn); sleep(5000); } @@ -105,11 +105,11 @@ function runFirstMongodAndFillDisk() { function runSecondMongdAndRecover() { // restart and recover log(); - conn = startMongodNoReset("--port", 30003, "--dbpath", startPath, "--dur", "--smallfiles", "--durOptions", 8+64, "--noprealloc"); + conn = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: startPath, dur: "", smallfiles: "", durOptions: 8+64, noprealloc: ""}); verify(); log("stop"); - stopMongod(30003); + MongoRunner.stopMongod(conn); // stopMongod seems to be asynchronous (hmmm) so we sleep here. sleep(5000); diff --git a/jstests/dur/dropdb.js b/jstests/dur/dropdb.js index 54de6bdd7f2..4e0cc73f811 100644 --- a/jstests/dur/dropdb.js +++ b/jstests/dur/dropdb.js @@ -110,20 +110,20 @@ var path2 = MongoRunner.dataPath + testname + "dur"; // non-durable version log("mongod nodur"); -conn = startMongodEmpty("--port", 30000, "--dbpath", path1, "--nodur", "--smallfiles"); +conn = MongoRunner.runMongod({dbpath: path1, nodur: "", smallfiles: ""}); work(); verify(); -stopMongod(30000); +MongoRunner.stopMongod(conn); // durable version log("mongod dur"); -conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); +conn = MongoRunner.runMongod({dbpath: path2, dur: "", smallfiles: "", durOptions: 8}); work(); verify(); // kill the process hard log("kill 9"); -stopMongod(30001, /*signal*/9); +MongoRunner.stopMongod(conn.port, /*signal*/9); // journal file should be present, and non-empty as we killed hard @@ -133,13 +133,13 @@ removeFile(path2 + "/test.0"); removeFile(path2 + "/lsn"); log("restart and recover"); -conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 9); +conn = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: path2, dur: "", smallfiles: "", durOptions: 9}); log("verify after recovery"); verify(); log("stop mongod 30002"); -stopMongod(30002); +MongoRunner.stopMongod(conn); sleep(5000); // at this point, after clean shutdown, there should be no journal files diff --git a/jstests/dur/dur1.js b/jstests/dur/dur1.js index 0aecaaac21c..4668b4921e2 100755 --- a/jstests/dur/dur1.js +++ b/jstests/dur/dur1.js @@ -94,13 +94,13 @@ var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version log("run mongod without journaling"); -conn = startMongodEmpty("--port", 30000, "--dbpath", path1, "--nodur", "--smallfiles"); +conn = MongoRunner.runMongod({dbpath: path1, nodur: "", smallfiles: ""}); work(); -stopMongod(30000); +MongoRunner.stopMongod(conn); // durable version log("run mongod with --journal"); -conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--journal", "--smallfiles", "--journalOptions", 8); +conn = MongoRunner.runMongod({dbpath: path2, journal: "", smallfiles: "", journalOptions: 8}); work(); // wait for group commit. @@ -108,17 +108,22 @@ printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); // kill the process hard
log("kill 9"); -stopMongod(30001, /*signal*/9); +MongoRunner.stopMongod(conn.port, /*signal*/9); // journal file should be present, and non-empty as we killed hard // restart and recover log("restart mongod --journal and recover"); -conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--journal", "--smallfiles", "--journalOptions", 8); +conn = MongoRunner.runMongod({restart: true, + cleanData: false, + dbpath: path2, + journal: "", + smallfiles: "", + journalOptions: 8}); verify(); log("stop mongod"); -stopMongod(30002); +MongoRunner.stopMongod(conn); // stopMongod seems to be asynchronous (hmmm) so we sleep here. // sleep(5000); diff --git a/jstests/dur/dur1_tool.js b/jstests/dur/dur1_tool.js index f50c3d123c2..f86e643b6f7 100755 --- a/jstests/dur/dur1_tool.js +++ b/jstests/dur/dur1_tool.js @@ -93,13 +93,14 @@ var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version log("run mongod without journaling"); -conn = startMongodEmpty("--port", 30000, "--dbpath", path1, "--nodur", "--smallfiles"); + +conn = MongoRunner.runMongod({dbpath: path1, nodur: "", smallfiles: ""}); work(); -stopMongod(30000); +MongoRunner.stopMongod(conn); // durable version log("run mongod with --journal"); -conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--journal", "--smallfiles", "--journalOptions", 8); +conn = MongoRunner.runMongod({dbpath: path2, journal: "", smallfiles: "", journalOptions: 8}); work(); // wait for group commit. @@ -107,18 +108,22 @@ printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); // kill the process hard
log("kill 9"); -stopMongod(30001, /*signal*/9); +MongoRunner.stopMongod(conn, /*signal*/9); // journal file should be present, and non-empty as we killed hard // mongod with --dbpath and --journal options should do a recovery pass // empty.bson is an empty file so it won't actually insert anything log("use mongod to recover"); -conn = startMongoProgram('mongod', '--port', 30001, '--dbpath', path2, - '--journal', '--smallfiles', - '--nohttpinterface', '--noprealloc', '--bind_ip', '127.0.0.1'); +conn = MongoRunner.runMongod({restart: true, + cleanData: false, + dbpath: path2, + journal: "", + smallfiles: "", + noprealloc: "", + bind_ip: "127.0.0.1"}); verify(); -stopMongod(30001); +MongoRunner.stopMongod(conn); // at this point, after clean shutdown, there should be no journal files log("check no journal files (after presumably clean shutdown)"); diff --git a/jstests/dur/dur2.js b/jstests/dur/dur2.js index 25cf8b1ccb2..2748f69505e 100644 --- a/jstests/dur/dur2.js +++ b/jstests/dur/dur2.js @@ -68,21 +68,33 @@ if( debugging ) { var path = MongoRunner.dataPath + testname+"dur"; log("run mongod with --dur"); -conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur", "--smallfiles", "--durOptions", /*DurParanoid*/8, "--master", "--oplogSize", 64); +conn = MongoRunner.runMongod({dbpath: path, + dur: "", + smallfiles: "", + durOptions: 8 /*DurParanoid*/, + master: "", + oplogSize: 64}); work();
log("kill -9"); -stopMongod(30001, /*signal*/9);
+MongoRunner.stopMongod(conn, /*signal*/9);
// journal file should be present, and non-empty as we killed hard
assert(listFiles(path + "/journal/").length > 0, "journal directory is unexpectantly empty after kill"); // restart and recover log("restart mongod and recover"); -conn = startMongodNoReset("--port", 30002, "--dbpath", path, "--dur", "--smallfiles", "--durOptions", 8, "--master", "--oplogSize", 64); +conn = MongoRunner.runMongod({restart: true, + cleanData: false, + dbpath: path, + dur: "", + smallfiles: "", + durOptions: 8, + master: "", + oplogSize: 64}); verify(); -log("stopping mongod 30002"); -stopMongod(30002); +log("stopping mongod " + conn.port); +MongoRunner.stopMongod(conn); print(testname + " SUCCESS"); diff --git a/jstests/dur/dur_jscore_passthrough.js b/jstests/dur/dur_jscore_passthrough.js index 859be03d456..30ef17cd44b 100644 --- a/jstests/dur/dur_jscore_passthrough.js +++ b/jstests/dur/dur_jscore_passthrough.js @@ -5,8 +5,7 @@ //TODO(mathias) add --master or make another test //conn = startMongodEmpty("--port", 30200, "--dbpath", MongoRunner.dataDir + "/dur_passthrough", "--dur", "--smallfiles", "--durOptions", "24"); -conn = startMongodEmpty("--port", 30200, "--dbpath", MongoRunner.dataDir + "/dur_passthrough", "--dur", "--nopreallocj", "--smallfiles", -"--durOptions", "8"); +var conn = MongoRunner.runMongod({dur: "", nopreallocj: "", smallfiles: "", durOptions: 8}); db = conn.getDB("test"); conn.forceWriteMode("commands"); @@ -38,7 +37,7 @@ function doTest() { } ); - stopMongod(30200); + MongoRunner.stopMongod(conn); var runnerEnd = new Date() diff --git a/jstests/dur/indexbg.js b/jstests/dur/indexbg.js index 71df92a41f6..60904acd917 100644 --- a/jstests/dur/indexbg.js +++ b/jstests/dur/indexbg.js @@ -1,6 +1,6 @@ path = MongoRunner.dataDir + '/indexbg_dur'; -m = startMongodEmpty( '--port', 30001, '--dbpath', path, '--journal', '--smallfiles', '--journalOptions', 24 ); +var m = MongoRunner.runMongod({journal: "", smallfiles: "", journalOptions: 24}); t = m.getDB( 'test' ).test; t.save( {x:1} ); t.createIndex( {x:1}, {background:true} ); diff --git a/jstests/dur/indexbg2.js b/jstests/dur/indexbg2.js index d239d4eaa44..b3234af432f 100644 --- a/jstests/dur/indexbg2.js +++ b/jstests/dur/indexbg2.js @@ -1,6 +1,6 @@ path = MongoRunner.dataDir + '/indexbg2_dur'; -m = startMongodEmpty( '--port', 30001, '--dbpath', path, '--journal', '--smallfiles' ); +var m = MongoRunner.runMongod({journal: "", smallfiles: ""}); t = m.getDB( 'test' ).test; t.createIndex( {a:1} ); diff --git a/jstests/dur/lsn.js b/jstests/dur/lsn.js index 93adf72b42e..347db279666 100755 --- a/jstests/dur/lsn.js +++ b/jstests/dur/lsn.js @@ -76,14 +76,20 @@ var path2 = MongoRunner.dataPath + testname+"dur"; // run mongod with a short --syncdelay to make LSN writing sooner log("run mongod --dur and a short --syncdelay"); -conn = startMongodEmpty("--syncdelay", 2, "--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", /*DurParanoid*/8, "--master", "--oplogSize", 64); +conn = MongoRunner.runMongod({dbpath: path2, + syncdelay: 2, + dur: "", + smallfiles: "", + durOptions: 8 /*DurParanoid*/, + master: "", + oplogSize: 64}); work(); log("wait a while for a sync and an lsn write"); sleep(14); // wait for lsn write log("kill mongod -9"); -stopMongod(30001, /*signal*/9); +MongoRunner.stopMongod(conn, /*signal*/9); // journal file should be present, and non-empty as we killed hard @@ -103,7 +109,14 @@ stopMongod(30001, /*signal*/9); // restart and recover log("restart mongod, recover, verify"); -conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 24, "--master", "--oplogSize", 64); +conn = MongoRunner.runMongod({restart:true, + cleanData: false, + dbpath: path2, + dur: "", + smallfiles: "", + durOptions: 24, + master: "", + oplogSize: 64}); verify(); // idea here is to verify (in a simplistic way) that we are in a good state to do further ops after recovery @@ -120,7 +133,7 @@ log("add data after recovery"); d.xyz.insert({ x: 1 }); } -log("stop mongod 30002"); -stopMongod(30002); +log("stop mongod " + conn.port); +MongoRunner.stopMongod(conn); print(testname + " SUCCESS"); diff --git a/jstests/dur/manyRestart.js b/jstests/dur/manyRestart.js index 5a68afdecbb..f30b068a79a 100755 --- a/jstests/dur/manyRestart.js +++ b/jstests/dur/manyRestart.js @@ -105,29 +105,29 @@ var path1 = MongoRunner.dataPath + testname+"nodur"; var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version -log("starting 30000"); -conn = startMongodEmpty("--port", 30000, "--dbpath", path1, "--nodur", "--smallfiles"); +log("starting first mongod"); +conn = MongoRunner.runMongod({dbpath: path1, nodur: "", smallfiles: ""}); work(); -stopMongod(30000); +MongoRunner.stopMongod(conn); // hail mary for windows // Sat Jun 11 14:07:57 Error: boost::filesystem::create_directory: Access is denied: "\data\db\manyRestartsdur" (anon):1 sleep(1000); -log("starting 30001"); -conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); +log("starting second mongod"); +conn = MongoRunner.runMongod({dbpath: path2, dur: "", smallfiles: "", durOptions: 8}); work(); // wait for group commit. printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); -stopMongod(30001); +MongoRunner.stopMongod(conn); sleep(5000); for (var i = 0; i < 3; ++i) { // durable version - log("restarting 30001"); - conn = startMongodNoReset("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); + log("restarting second mongod"); + conn = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: path2, dur: "", smallfiles: "", durOptions: 8}); // wait for group commit. printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); @@ -136,7 +136,7 @@ for (var i = 0; i < 3; ++i) { // kill the process hard log("hard kill"); - stopMongod(30001, /*signal*/9); + MongoRunner.stopMongod(conn, /*signal*/9); sleep(5000); } @@ -145,11 +145,11 @@ for (var i = 0; i < 3; ++i) { // restart and recover log("restart"); -conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); +conn = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: path2, dur: "", smallfiles: "", durOptions: 8}); log("verify"); verify(); log("stop"); -stopMongod(30002); +MongoRunner.stopMongod(conn); sleep(5000); // at this point, after clean shutdown, there should be no journal files @@ -170,8 +170,8 @@ var nrows = 0; for (var i = 0; i < 5; ++i) { // durable version - log("restarting 30001"); - conn = startMongodNoReset("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); + log("restarting second mongod"); + conn = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: path2, dur: "", smallfiles: "", durOptions: 8}); nrows += addRows(); // wait for group commit. printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); @@ -180,7 +180,7 @@ for (var i = 0; i < 5; ++i) { // kill the process hard log("hard kill"); - stopMongod(30001, /*signal*/9); + MongoRunner.stopMongod(conn, /*signal*/9); sleep(5000); } diff --git a/jstests/dur/oplog.js b/jstests/dur/oplog.js index 8ded3c980a9..d0829f66f8b 100755 --- a/jstests/dur/oplog.js +++ b/jstests/dur/oplog.js @@ -103,30 +103,42 @@ var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version log(); -conn = startMongodEmpty("--port", 30000, "--dbpath", path1, "--nodur", "--smallfiles", "--master", "--oplogSize", 64); +conn = MongoRunner.runMongod({dbpath: path1, nodur: "", smallfiles: "", master: "", oplogSize: 64}); work(); -stopMongod(30000); +MongoRunner.stopMongod(conn); // durable version log(); -conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", /*DurParanoid*/8, "--master", "--oplogSize", 64); +conn = MongoRunner.runMongod({dbpath: path2, + dur: "", + smallfiles: "", + durOptions: 8 /*DurParanoid*/, + master: "", + oplogSize: 64}); work(); // wait for group commit. printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); // kill the process hard -stopMongod(30001, /*signal*/9); +MongoRunner.stopMongod(conn, /*signal*/9); // journal file should be present, and non-empty as we killed hard // restart and recover log(); -conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8, "--master", "--oplogSize", 64); +conn = MongoRunner.runMongod({restart: true, + cleanData: false, + dbpath: path2, + dur: "", + smallfiles: "", + durOptions: 8, + master: "", + oplogSize: 64}); verify(); log("stop"); -stopMongod(30002); +MongoRunner.stopMongod(conn); // stopMongod seems to be asynchronous (hmmm) so we sleep here. sleep(5000); |