Skip to content

Commit a24132d

Browse files
chore(NODE-4431): fix failing change stream tests & csfle tests on windows (#3326)
1 parent 5ab2b05 commit a24132d

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

test/integration/change-streams/change_stream.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,17 @@ describe('ChangeStream resumability', function () {
15291529
const is4_2Server = (serverVersion: string) =>
15301530
gte(serverVersion, '4.2.0') && lt(serverVersion, '4.3.0');
15311531

1532+
beforeEach(function () {
1533+
assert(this.currentTest != null);
1534+
if (
1535+
this.currentTest.title.includes('StaleShardVersion') &&
1536+
gte(this.configuration.version, '6.0.0')
1537+
) {
1538+
this.currentTest.skipReason = 'TODO(NODE-4434): fix StaleShardVersion resumability test';
1539+
this.skip();
1540+
}
1541+
});
1542+
15321543
beforeEach(async function () {
15331544
const dbName = 'resumabilty_tests';
15341545
const collectionName = 'foo';
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import * as path from 'path';
2+
import { gte } from 'semver';
23

34
import { loadSpecTests } from '../../spec';
45
import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';
56

67
describe('Change Streams Spec - Unified', function () {
7-
runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified')));
8+
runUnifiedSuite(
9+
loadSpecTests(path.join('change-streams', 'unified')),
10+
({ description }, { version }) =>
11+
description === 'change stream resumes after StaleShardVersion' && gte(version, '6.0.0')
12+
? 'TODO(NODE-4434): fix StaleShardVersion resumability tests'
13+
: false
14+
);
815
});

test/readme.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,6 @@ The following steps will walk you through how to run the tests for CSFLE.
402402
set -e CREDS
403403
```
404404

405-
1. If you are running the unified tests, you must set the following environment variable as well:
406-
407-
```shell
408-
export TEST_CSFLE=true
409-
```
410-
411405
1. Run the functional tests:
412406

413407
`npm run check:test`

test/tools/unified-spec-runner/runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function runUnifiedTest(
5858
const schemaVersion = patchVersion(unifiedSuite.schemaVersion);
5959
expect(semverSatisfies(schemaVersion, uni.SupportedVersion)).to.be.true;
6060

61-
const skipReason = test.skipReason ?? skipFilter(test);
61+
const skipReason = test.skipReason ?? skipFilter(test, ctx.configuration);
6262

6363
if (typeof skipReason === 'string') {
6464
if (skipReason.length === 0) {

test/tools/unified-spec-runner/schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { ReadConcernLevel } from '../../../src/read_concern';
44
import type { ReadPreferenceMode } from '../../../src/read_preference';
55
import type { TagSet } from '../../../src/sdam/server_description';
66
import type { W } from '../../../src/write_concern';
7+
import { TestConfiguration } from '../runner/config';
78

89
export const SupportedVersion = '^1.0';
910

@@ -289,7 +290,7 @@ export interface ExpectedError {
289290
/**
290291
* A type that represents the test filter provided to the unifed runner.
291292
*/
292-
export type TestFilter = (test: Test) => string | false;
293+
export type TestFilter = (test: Test, ctx: TestConfiguration) => string | false;
293294

294295
/**
295296
* This interface represents the bare minimum of type information needed to get *some* type

test/tools/unified-spec-runner/unified-utils.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,16 @@ export async function topologySatisfies(
111111

112112
if (typeof r.csfle === 'boolean') {
113113
if (r.csfle) {
114-
ok &&= typeof process.env.TEST_CSFLE === 'string' && process.env.TEST_CSFLE === 'true';
114+
ok &&= config.clientSideEncryption.enabled;
115115

116116
if (!ok && skipReason == null) {
117-
skipReason = `requires csfle but the TEST_CSFLE environment variable is not set`;
117+
skipReason = `requires csfle to run but CSFLE is not set for this environment`;
118118
}
119119
} else {
120-
ok &&= typeof process.env.TEST_CSFLE === 'undefined';
120+
ok &&= config.clientSideEncryption.enabled;
121121

122122
if (!ok && skipReason == null) {
123-
skipReason = `requires no csfle but the TEST_CSFLE environment variable is set with value ${JSON.stringify(
124-
process.env.TEST_CSFLE
125-
)}`;
123+
skipReason = `forbids csfle but CSFLE is set for this environment`;
126124
}
127125
}
128126
}

0 commit comments

Comments
 (0)