summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Russell <gabriel.russell@mongodb.com>2020-02-18 12:43:21 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-18 19:24:38 +0000
commit0711413609c4dacc4552da8c71d9d93d6cae5e9b (patch)
tree76184b5baee13c8d5721fb7a22feb2edb6dc9a64
parent046a1a3f14c42dc52f1d83c9e2fdb6127783a8d6 (diff)
downloadmongo-0711413609c4dacc4552da8c71d9d93d6cae5e9b.tar.gz
SERVER-46026 disk_wiredtiger tests against structured logs
-rw-r--r--jstests/disk/libs/wt_file_helper.js12
-rw-r--r--jstests/disk/wt_corrupt_file_errors.js8
-rw-r--r--jstests/disk/wt_missing_file_errors.js8
3 files changed, 14 insertions, 14 deletions
diff --git a/jstests/disk/libs/wt_file_helper.js b/jstests/disk/libs/wt_file_helper.js
index 95b4e7d8411..fda0f7b1dc1 100644
--- a/jstests/disk/libs/wt_file_helper.js
+++ b/jstests/disk/libs/wt_file_helper.js
@@ -83,7 +83,7 @@ let assertErrorOnStartupWhenStartingAsReplSet = function(dbpath, port, rsName) {
let node = MongoRunner.runMongod(
{dbpath: dbpath, port: port, replSet: rsName, noCleanData: true, waitForConnect: false});
assert.soon(function() {
- return rawMongoProgramOutput().indexOf("Fatal Assertion 50923") >= 0;
+ return rawMongoProgramOutput().search(/Fatal Assertion.*50923/) >= 0;
});
MongoRunner.stopMongod(node, null, {allowedExitCode: MongoRunner.EXIT_ABRUPT});
};
@@ -99,7 +99,7 @@ let assertErrorOnStartupAfterIncompleteRepair = function(dbpath, port) {
let node = MongoRunner.runMongod(
{dbpath: dbpath, port: port, noCleanData: true, waitForConnect: false});
assert.soon(function() {
- return rawMongoProgramOutput().indexOf("Fatal Assertion 50922") >= 0;
+ return rawMongoProgramOutput().search(/Fatal Assertion.*50922/) >= 0;
});
MongoRunner.stopMongod(node, null, {allowedExitCode: MongoRunner.EXIT_ABRUPT});
};
@@ -156,7 +156,7 @@ let assertStartInReplSet = function(replSet, originalNode, cleanData, expectResy
* Assert certain error messages are thrown on startup when files are missing or corrupt.
*/
let assertErrorOnStartupWhenFilesAreCorruptOrMissing = function(
- dbpath, dbName, collName, deleteOrCorruptFunc, errmsg) {
+ dbpath, dbName, collName, deleteOrCorruptFunc, errmsgRegExp) {
// Start a MongoDB instance, create the collection file.
const mongod = MongoRunner.runMongod({dbpath: dbpath, cleanData: true});
const testColl = mongod.getDB(dbName)[collName];
@@ -170,14 +170,14 @@ let assertErrorOnStartupWhenFilesAreCorruptOrMissing = function(
clearRawMongoProgramOutput();
assert.eq(MongoRunner.EXIT_ABRUPT,
runMongoProgram("mongod", "--port", mongod.port, "--dbpath", dbpath));
- assert.gte(rawMongoProgramOutput().indexOf(errmsg), 0);
+ assert.gte(rawMongoProgramOutput().search(errmsgRegExp), 0);
};
/**
* Assert certain error messages are thrown on a specific request when files are missing or corrupt.
*/
let assertErrorOnRequestWhenFilesAreCorruptOrMissing = function(
- dbpath, dbName, collName, deleteOrCorruptFunc, requestFunc, errmsg) {
+ dbpath, dbName, collName, deleteOrCorruptFunc, requestFunc, errmsgRegExp) {
// Start a MongoDB instance, create the collection file.
mongod = MongoRunner.runMongod({dbpath: dbpath, cleanData: true});
testColl = mongod.getDB(dbName)[collName];
@@ -196,6 +196,6 @@ let assertErrorOnRequestWhenFilesAreCorruptOrMissing = function(
requestFunc(testColl);
// Get an expected error message.
- assert.gte(rawMongoProgramOutput().indexOf(errmsg), 0);
+ assert.gte(rawMongoProgramOutput().search(errmsgRegExp), 0);
MongoRunner.stopMongod(mongod, 9, {allowedExitCode: MongoRunner.EXIT_ABRUPT});
};
diff --git a/jstests/disk/wt_corrupt_file_errors.js b/jstests/disk/wt_corrupt_file_errors.js
index 28fa915002e..ec1f76b3a52 100644
--- a/jstests/disk/wt_corrupt_file_errors.js
+++ b/jstests/disk/wt_corrupt_file_errors.js
@@ -32,7 +32,7 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- "Fatal Assertion 50882");
+ new RegExp("Fatal Assertion.*50882"));
/**
* Test 2. Corrupt the _mdb_catalog.
@@ -43,7 +43,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
const mdbCatalogFile = dbpath + "_mdb_catalog.wt";
jsTestLog("corrupting catalog file: " + mdbCatalogFile);
corruptFile(mdbCatalogFile);
-}, "Fatal Assertion 50882");
+}, new RegExp("Fatal Assertion.*50882"));
/**
* Test 3. Corrupt the WiredTiger.wt.
@@ -54,7 +54,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
const WiredTigerWTFile = dbpath + "WiredTiger.wt";
jsTestLog("corrupting WiredTiger.wt");
corruptFile(WiredTigerWTFile);
-}, "Fatal Assertion 50944");
+}, new RegExp("Fatal Assertion.*50944"));
/**
* Test 4. Corrupt an index file.
@@ -80,5 +80,5 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- "Fatal Assertion 50882");
+ new RegExp("Fatal Assertion.*50882"));
})();
diff --git a/jstests/disk/wt_missing_file_errors.js b/jstests/disk/wt_missing_file_errors.js
index 96e5f936689..9abb24fafdc 100644
--- a/jstests/disk/wt_missing_file_errors.js
+++ b/jstests/disk/wt_missing_file_errors.js
@@ -32,7 +32,7 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- "Fatal Assertion 50883");
+ new RegExp("Fatal Assertion.*50883"));
/**
* Test 2. Delete the _mdb_catalog.
@@ -43,7 +43,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
let mdbCatalogFile = dbpath + "_mdb_catalog.wt";
jsTestLog("deleting catalog file: " + mdbCatalogFile);
removeFile(mdbCatalogFile);
-}, "Fatal Assertion 50883");
+}, new RegExp("Fatal Assertion.*50883"));
/**
* Test 3. Delete the WiredTiger.wt.
@@ -54,7 +54,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
let WiredTigerWTFile = dbpath + "WiredTiger.wt";
jsTestLog("deleting WiredTiger.wt");
removeFile(WiredTigerWTFile);
-}, "Fatal Assertion 50944");
+}, new RegExp("Fatal Assertion.*50944"));
/**
* Test 4. Delete an index file.
@@ -80,5 +80,5 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- "Fatal Assertion 50883");
+ new RegExp("Fatal Assertion.*50883"));
})();