diff --git a/jstests/noPassthrough/invalid_collection_validator_at_startup.js b/jstests/noPassthrough/invalid_collection_validator_at_startup.js
|
index 2d453345a0..21a9e97e63 100644
|
--- a/jstests/noPassthrough/invalid_collection_validator_at_startup.js
|
+++ b/jstests/noPassthrough/invalid_collection_validator_at_startup.js
|
@@ -12,13 +12,20 @@ const collName = "collectionWithMalformedValidator";
|
|
// Create a collection with an invalid regex using a fail point.
|
(function createCollectionWithMalformedValidator() {
|
- const conn = MongoRunner.runMongod({dbpath: dbpath});
|
- assert.neq(null, conn, "mongod was unable to start up");
|
+ // const conn = MongoRunner.runMongod({dbpath: dbpath});
|
+ // assert.neq(null, conn, "mongod was unable to start up");
|
|
- const testDB = conn.getDB("test");
|
+ const rst = new ReplSetTest({
|
+ nodes: 3,
|
+ });
|
+ rst.startSet();
|
+ rst.initiate();
|
+
|
+ // const testDB = conn.getDB("test");
|
+ const testDB = rst.getPrimary().getDB("test");
|
assert.commandWorked(testDB[collName].insert({a: "hello world"}));
|
|
- assert.commandWorked(conn.adminCommand(
|
+ assert.commandWorked(testDB.adminCommand(
|
{configureFailPoint: 'allowSettingMalformedCollectionValidators', mode: 'alwaysOn'}));
|
|
// Invalid because '*' indicates that repetitions should be allowed but it's preceded by a
|
@@ -29,13 +36,21 @@ const collName = "collectionWithMalformedValidator";
|
assert.commandWorked(
|
testDB.runCommand({collMod: collName, validator: {email: {$regex: invalidRegex}}}));
|
|
- MongoRunner.stopMongod(conn);
|
+ // MongoRunner.stopMongod(conn);
|
+ rst.stopSet();
|
})();
|
|
(function startUpWithMalformedValidator() {
|
- const conn = MongoRunner.runMongod({dbpath: dbpath, noCleanData: true});
|
- assert.neq(null, conn, "mongod was unable to start up");
|
- const testDB = conn.getDB("test");
|
+ // const conn = MongoRunner.runMongod({dbpath: dbpath, noCleanData: true});
|
+ // assert.neq(null, conn, "mongod was unable to start up");
|
+ // const testDB = conn.getDB("test");
|
+ const rst = new ReplSetTest({
|
+ nodes: 3,
|
+ nodeOptions: {noCleanData: true},
|
+ });
|
+ rst.startSet();
|
+ rst.initiate();
|
+ const testDB = rst.getPrimary().getDB("test");
|
|
// Check that we logged a startup warning.
|
const cmdRes = assert.commandWorked(testDB.adminCommand({getLog: "startupWarnings"}));
|
@@ -48,6 +63,7 @@ const collName = "collectionWithMalformedValidator";
|
assert.commandWorked(testDB.someOtherCollection.insert({a: 1}));
|
assert.eq(testDB.someOtherCollection.find().itcount(), 1);
|
|
- MongoRunner.stopMongod(conn);
|
+ // MongoRunner.stopMongod(conn);
|
+ rst.stopSet();
|
})();
|
})();
|
|