Skip to content

Commit 1daf62d

Browse files
committed
test(NODE-4271): check message not code
1 parent d0861e6 commit 1daf62d

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

test/tools/spec-runner/index.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -201,25 +201,23 @@ function generateTopologyTests(testSuites, testContext, filter) {
201201
beforeEach(beforeEachFilter);
202202
beforeEach(() => prepareDatabaseForSuite(testSuite, testContext));
203203
afterEach(() => testContext.cleanupAfterSuite());
204-
if (testSuite.name.includes('fle2-')) {
205-
for (const spec of testSuite.tests) {
206-
const mochaTest = it(spec.description, async function () {
207-
if (spec.failPoint) {
208-
await testContext.enableFailPoint(spec.failPoint);
209-
}
204+
for (const spec of testSuite.tests) {
205+
const mochaTest = it(spec.description, async function () {
206+
if (spec.failPoint) {
207+
await testContext.enableFailPoint(spec.failPoint);
208+
}
210209

211-
// run the actual test
212-
await runTestSuiteTest(this.configuration, spec, testContext);
210+
// run the actual test
211+
await runTestSuiteTest(this.configuration, spec, testContext);
213212

214-
if (spec.failPoint) {
215-
await testContext.disableFailPoint(spec.failPoint);
216-
}
213+
if (spec.failPoint) {
214+
await testContext.disableFailPoint(spec.failPoint);
215+
}
217216

218-
await validateOutcome(spec, testContext);
219-
});
220-
// Make the spec test available to the beforeEach filter
221-
mochaTest.spec = spec;
222-
}
217+
await validateOutcome(spec, testContext);
218+
});
219+
// Make the spec test available to the beforeEach filter
220+
mochaTest.spec = spec;
223221
}
224222
});
225223
}
@@ -675,7 +673,7 @@ const kOperations = new Map([
675673
const encryptedFields = operation.arguments.encryptedFields;
676674
const session = maybeSession(operation, context);
677675
return db.dropCollection(collectionName, { session, encryptedFields }).catch(err => {
678-
if (err.code !== MONGODB_ERROR_CODES.NamespaceNotFound) {
676+
if (!err.message.match(/ns not found/)) {
679677
throw err;
680678
}
681679
});
@@ -762,7 +760,8 @@ const kOperations = new Map([
762760
.then(results => results.map(({ name }) => name))
763761
.then(indexes => expect(indexes).to.not.include(indexName))
764762
).catch(err => {
765-
if (err.code !== MONGODB_ERROR_CODES.NamespaceNotFound) {
763+
// The error message can differ slightly with the same error code.
764+
if (!err.message.match(/ns not found|ns does not exist/)) {
766765
throw err;
767766
}
768767
});

0 commit comments

Comments
 (0)