Skip to content

Commit 90d2531

Browse files
committed
test(NODE-4271): fix casting errors in tests
1 parent b0579ca commit 90d2531

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

test/tools/spec-runner/index.js

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,28 @@ function translateClientOptions(options) {
9595
return options;
9696
}
9797

98+
function isRelaxed(fileName) {
99+
return (
100+
!fileName.includes('fle2-CreateCollection') &&
101+
!fileName.includes('fle2-BypassQueryAnalysis') &&
102+
!fileName.includes('fle2-validatorAndPartialFieldExpression') &&
103+
!fileName.includes('fle2-EncryptedFields-vs-jsonSchema') &&
104+
!fileName.includes('fle2-FindOneAndUpdate') &&
105+
!fileName.includes('fle2-InsertFind-Indexed') &&
106+
!fileName.includes('fle2-InsertFind-Unindexed') &&
107+
!fileName.includes('fle2-Update') &&
108+
!fileName.includes('fle2-Delete')
109+
);
110+
}
111+
98112
function gatherTestSuites(specPath) {
99113
return fs
100114
.readdirSync(specPath)
101115
.filter(x => x.indexOf('.json') !== -1)
102116
.map(x =>
103117
Object.assign(
104118
EJSON.parse(fs.readFileSync(path.join(specPath, x)), {
105-
relaxed: !x.includes('fle2-CreateCollection')
119+
relaxed: isRelaxed(x)
106120
}),
107121
{
108122
name: path.basename(x, '.json')
@@ -206,23 +220,25 @@ function generateTopologyTests(testSuites, testContext, filter) {
206220
beforeEach(beforeEachFilter);
207221
beforeEach(() => prepareDatabaseForSuite(testSuite, testContext));
208222
afterEach(() => testContext.cleanupAfterSuite());
209-
for (const spec of testSuite.tests) {
210-
const mochaTest = it(spec.description, async function () {
211-
if (spec.failPoint) {
212-
await testContext.enableFailPoint(spec.failPoint);
213-
}
223+
if (testSuite.name.includes('fle2-')) {
224+
for (const spec of testSuite.tests) {
225+
const mochaTest = it(spec.description, async function () {
226+
if (spec.failPoint) {
227+
await testContext.enableFailPoint(spec.failPoint);
228+
}
214229

215-
// run the actual test
216-
await runTestSuiteTest(this.configuration, spec, testContext);
230+
// run the actual test
231+
await runTestSuiteTest(this.configuration, spec, testContext);
217232

218-
if (spec.failPoint) {
219-
await testContext.disableFailPoint(spec.failPoint);
220-
}
233+
if (spec.failPoint) {
234+
await testContext.disableFailPoint(spec.failPoint);
235+
}
221236

222-
await validateOutcome(spec, testContext);
223-
});
224-
// Make the spec test available to the beforeEach filter
225-
mochaTest.spec = spec;
237+
await validateOutcome(spec, testContext);
238+
});
239+
// Make the spec test available to the beforeEach filter
240+
mochaTest.spec = spec;
241+
}
226242
}
227243
});
228244
}

0 commit comments

Comments
 (0)