diff options
author | dwight <dwight@10gen.com> | 2011-02-04 21:02:48 -0500 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2011-02-04 21:02:48 -0500 |
commit | adb1308bb89786bbe93099f1ecf04bed6c03a331 (patch) | |
tree | c3764dfb13446f52bf9f4f3841474cf661c8b5fc | |
parent | f94110baedf5c14342767d32bc85157ac434aa75 (diff) | |
download | mongo-adb1308bb89786bbe93099f1ecf04bed6c03a331.tar.gz |
fix tests
-rwxr-xr-x | jstests/dur/a_quick.js | 35 | ||||
-rw-r--r-- | jstests/dur/diskfull.js | 24 | ||||
-rw-r--r-- | jstests/dur/dropdb.js | 22 | ||||
-rwxr-xr-x | jstests/dur/dur1.js | 26 | ||||
-rwxr-xr-x | jstests/dur/manyRestart.js | 22 | ||||
-rwxr-xr-x | jstests/dur/oplog.js | 22 |
6 files changed, 113 insertions, 38 deletions
diff --git a/jstests/dur/a_quick.js b/jstests/dur/a_quick.js index 388572609f8..f703f3f35c5 100755 --- a/jstests/dur/a_quick.js +++ b/jstests/dur/a_quick.js @@ -5,7 +5,23 @@ */ testname = "a_quick"; -load("jstests/_tst.js"); +load("jstests/_tst.js");
+
+function checkNoJournalFiles(path, pass) {
+ var files = listFiles(path);
+ if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) {
+ if (pass == null) {
+ // wait a bit longer for mongod to potentially finish if it is still running.
+ sleep(10000);
+ return checkNoJournalFiles(path, 1);
+ }
+ print("\n\n\n");
+ print("FAIL path:" + path);
+ print("unexpected files:");
+ printjson(files);
+ assert(false, "FAIL a journal/lsn file is present which is unexpected");
+ } +} // directories var path1 = "/data/db/quicknodur"; @@ -75,22 +91,7 @@ stopMongod(30002); // at this point, after clean shutdown, there should be no journal files tst.log("check no journal files"); -var jfiles = listFiles(path2 + "/journal"); -if (jfiles.length) { - print("sleeping more waiting for mongod to stop"); - sleep(10000);
- removeFile(path2 + "/journal/prealloc.0");
- removeFile(path2 + "/journal/prealloc.1");
- removeFile(path2 + "/journal/prealloc.2");
- jfiles = listFiles(path2 + "/journal");
-
- if (jfiles.length) {
- print("ERROR journal dir " + path2 + "/journal is not empty:"); - printjson(jfiles); - print("\n\n"); - assert(jfiles.length == 0, "journal dir not empty"); - } -} +checkNoJournalFiles(path2 + "/journal"); tst.log("check data matches"); var diff = tst.diff(path1 + "/test.ns", path2 + "/test.ns"); diff --git a/jstests/dur/diskfull.js b/jstests/dur/diskfull.js index 05546ff99ee..da45c20afd4 100644 --- a/jstests/dur/diskfull.js +++ b/jstests/dur/diskfull.js @@ -14,7 +14,23 @@ for ( i in files ) { if ( !doIt ) { print( "path " + startPath + " missing, skipping diskfull test" ); doIt = false; -} +}
+
+function checkNoJournalFiles(path, pass) {
+ var files = listFiles(path);
+ if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) {
+ if (pass == null) {
+ // wait a bit longer for mongod to potentially finish if it is still running.
+ sleep(10000);
+ return checkNoJournalFiles(path, 1);
+ }
+ print("\n\n\n");
+ print("FAIL path:" + path);
+ print("unexpected files:");
+ printjson(files);
+ assert(false, "FAIL a journal/lsn file is present which is unexpected");
+ }
+}
/** Clear dbpath without removing and recreating diskfulltest directory, as resetDbpath does */ function clear() { @@ -88,9 +104,9 @@ function runSecondMongdAndRecover() { // stopMongod seems to be asynchronous (hmmm) so we sleep here. sleep(5000); - // at this point, after clean shutdown, there should be no journal files - log("check no journal files"); - assert.eq( [], listFiles( startPath + "/journal/" ), "error seem to be journal files present after a clean mongod shutdown" ); + // at this point, after clean shutdown, there should be no journal files
+ log("check no journal files");
+ checkNoJournalFiles(startPath + "/journal/");
log(); } diff --git a/jstests/dur/dropdb.js b/jstests/dur/dropdb.js index 0df0f113894..8e1aeffb2b6 100644 --- a/jstests/dur/dropdb.js +++ b/jstests/dur/dropdb.js @@ -4,7 +4,23 @@ var debugging = false; var testname = "dropdb"; var step = 1; -var conn = null; +var conn = null;
+
+function checkNoJournalFiles(path, pass) {
+ var files = listFiles(path);
+ if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) {
+ if (pass == null) {
+ // wait a bit longer for mongod to potentially finish if it is still running.
+ sleep(10000);
+ return checkNoJournalFiles(path, 1);
+ }
+ print("\n\n\n");
+ print("FAIL path:" + path);
+ print("unexpected files:");
+ printjson(files);
+ assert(false, "FAIL a journal/lsn file is present which is unexpected");
+ }
+}
function runDiff(a, b) { function reSlash(s) { @@ -115,8 +131,8 @@ stopMongod(30002); sleep(5000); // at this point, after clean shutdown, there should be no journal files -log("check no journal files"); -assert.eq( [], listFiles(path2 + "/journal") ); +log("check no journal files");
+checkNoJournalFiles(path2 + "/journal"); log("check data matches ns"); var diff = runDiff(path1 + "/test.ns", path2 + "/test.ns"); diff --git a/jstests/dur/dur1.js b/jstests/dur/dur1.js index 2f8fd85f8b1..4c8f1bf3e57 100755 --- a/jstests/dur/dur1.js +++ b/jstests/dur/dur1.js @@ -5,7 +5,23 @@ var debugging = false; var testname = "dur1"; var step = 1; -var conn = null; +var conn = null;
+
+function checkNoJournalFiles(path, pass) {
+ var files = listFiles(path);
+ if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) {
+ if (pass == null) {
+ // wait a bit longer for mongod to potentially finish if it is still running.
+ sleep(10000);
+ return checkNoJournalFiles(path, 1);
+ }
+ print("\n\n\n");
+ print("FAIL path:" + path);
+ print("unexpected files:");
+ printjson(files);
+ assert(false, "FAIL a journal/lsn file is present which is unexpected");
+ }
+}
function runDiff(a, b) { function reSlash(s) { @@ -114,13 +130,7 @@ sleep(5000); // at this point, after clean shutdown, there should be no journal files log("check no journal files"); -{ - if (listFiles(path2 + "/journal") != []) { - // wait longer, stopMongod isn't synchronous - sleep(8000); - assert.eq( [], listFiles(path2 + "/journal"), "error seems to be journal files present after a clean mongod shutdown" ); - } -} +checkNoJournalFiles(path2 + "/journal"); log("check data matches ns"); var diff = runDiff(path1 + "/test.ns", path2 + "/test.ns"); diff --git a/jstests/dur/manyRestart.js b/jstests/dur/manyRestart.js index 46dab35e4fc..e54c3b3414c 100755 --- a/jstests/dur/manyRestart.js +++ b/jstests/dur/manyRestart.js @@ -5,7 +5,23 @@ var debugging = false; var testname = "manyRestarts"; var step = 1; -var conn = null; +var conn = null;
+
+function checkNoJournalFiles(path, pass) {
+ var files = listFiles(path);
+ if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) {
+ if (pass == null) {
+ // wait a bit longer for mongod to potentially finish if it is still running.
+ sleep(10000);
+ return checkNoJournalFiles(path, 1);
+ }
+ print("\n\n\n");
+ print("FAIL path:" + path);
+ print("unexpected files:");
+ printjson(files);
+ assert(false, "FAIL a journal/lsn file is present which is unexpected");
+ }
+}
function runDiff(a, b) { function reSlash(s) { @@ -136,8 +152,8 @@ stopMongod(30002); sleep(5000); // at this point, after clean shutdown, there should be no journal files -log("check no journal files"); -assert.eq( [], listFiles(path2 + "/journal"), "error seems to be journal files present after a clean mongod shutdown" ); +log("check no journal files");
+checkNoJournalFiles(path2 + "/journal"); log("check data matches ns"); var diff = runDiff(path1 + "/test.ns", path2 + "/test.ns"); diff --git a/jstests/dur/oplog.js b/jstests/dur/oplog.js index cb2fa71f16e..379c1b693fa 100755 --- a/jstests/dur/oplog.js +++ b/jstests/dur/oplog.js @@ -3,7 +3,23 @@ var debugging = false; var testname = "oplog"; var step = 1; -var conn = null; +var conn = null;
+
+function checkNoJournalFiles(path, pass) {
+ var files = listFiles(path);
+ if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) {
+ if (pass == null) {
+ // wait a bit longer for mongod to potentially finish if it is still running.
+ sleep(10000);
+ return checkNoJournalFiles(path, 1);
+ }
+ print("\n\n\n");
+ print("FAIL path:" + path);
+ print("unexpected files:");
+ printjson(files);
+ assert(false, "FAIL a journal/lsn file is present which is unexpected");
+ }
+}
function runDiff(a, b) { function reSlash(s) { @@ -119,8 +135,8 @@ stopMongod(30002); sleep(5000); // at this point, after clean shutdown, there should be no journal files -log("check no journal files"); -assert.eq( [], listFiles(path2 + "/journal") ); +log("check no journal files");
+checkNoJournalFiles(path2 + "/journal"); log("check data matches ns"); var diff = runDiff(path1 + "/test.ns", path2 + "/test.ns"); |