Skip to content

Commit 66ea88f

Browse files
test(NODE-4469): unskip all key management tests (#3322)
1 parent 05e007b commit 66ea88f

File tree

6 files changed

+17
-27
lines changed

6 files changed

+17
-27
lines changed

.evergreen/run-custom-csfle-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ABS_PATH_TO_PATCH=$(pwd)
2727
# CSFLE_GIT_REF - set the git reference to checkout for a custom CSFLE version
2828
# CDRIVER_GIT_REF - set the git reference to checkout for a custom CDRIVER version (this is for libbson)
2929

30-
CSFLE_GIT_REF=${CSFLE_GIT_REF:-e157c35ee4028b292883c4628dc5926f9742b34a}
30+
CSFLE_GIT_REF=${CSFLE_GIT_REF:-c2712248e9f4909cdad723607ea5291d2eb48b91}
3131
CDRIVER_GIT_REF=${CDRIVER_GIT_REF:-1.17.6}
3232

3333
rm -rf ../csfle-deps-tmp

.evergreen/run-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ else
5656
source "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
5757
fi
5858

59-
npm install mongodb-client-encryption@">=2.2.0-alpha.4"
59+
npm install mongodb-client-encryption@">=2.2.0-alpha.5"
6060
npm install @mongodb-js/zstd
6161
npm install snappy
6262

test/integration/client-side-encryption/client_side_encryption.spec.test.ts

+1-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
TestRunnerContext
88
} from '../../tools/spec-runner';
99
import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';
10-
import { TestFilter } from '../../tools/unified-spec-runner/schema';
1110

1211
const isAuthEnabled = process.env.AUTH === 'auth';
1312

@@ -81,19 +80,5 @@ describe('Client Side Encryption (Legacy)', function () {
8180
});
8281

8382
describe('Client Side Encryption (Unified)', function () {
84-
const filter: TestFilter = ({ description }) => {
85-
if (
86-
description.includes('create datakey with') ||
87-
description.includes('create data key with') ||
88-
description.includes('rewrap')
89-
) {
90-
if (description === 'no keys to rewrap due to no filter matches') {
91-
return 'TODO(NODE-4330): implement the key management API';
92-
}
93-
return false;
94-
}
95-
96-
return 'TODO(NODE-4330): implement the key management API';
97-
};
98-
runUnifiedSuite(loadSpecTests(path.join('client-side-encryption', 'tests', 'unified')), filter);
83+
runUnifiedSuite(loadSpecTests(path.join('client-side-encryption', 'tests', 'unified')));
9984
});

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ operations.set('getKey', async ({ entities, operation }) => {
510510
operations.set('getKeys', async ({ entities, operation }) => {
511511
const clientEncryption = entities.getEntity('clientEncryption', operation.object);
512512

513-
return clientEncryption.getKeys();
513+
return clientEncryption.getKeys().toArray();
514514
});
515515

516516
operations.set('addKeyAltName', async ({ entities, operation }) => {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MongoClient, ServerApiVersion } from '../../../src';
1+
import { FindCursor, MongoClient, ServerApiVersion } from '../../../src';
22
import type { Document, ObjectId } from '../../../src/bson';
33
import type { ReadConcernLevel } from '../../../src/read_concern';
44
import type { ReadPreferenceMode } from '../../../src/read_preference';
@@ -303,7 +303,7 @@ export interface ClientEncryption {
303303
rewrapManyDataKey(filter, options): Promise<any>;
304304
deleteKey(id): Promise<any>;
305305
getKey(id): Promise<any>;
306-
getKeys(): Promise<any>;
306+
getKeys(): FindCursor;
307307
addKeyAltName(id, keyAltName): Promise<any>;
308308
removeKeyAltName(id, keyAltName): Promise<any>;
309309
getKeyByAltName(keyAltName): Promise<any>;

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

+11-6
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,22 @@ export async function topologySatisfies(
110110
}
111111

112112
if (typeof r.csfle === 'boolean') {
113-
if (r.csfle) {
114-
ok &&= config.clientSideEncryption.enabled;
113+
const versionSupportsCSFLE = semverGte(config.version, '4.2.0');
114+
const csfleEnabled = config.clientSideEncryption.enabled;
115115

116+
if (r.csfle) {
117+
ok &&= versionSupportsCSFLE && csfleEnabled;
116118
if (!ok && skipReason == null) {
117-
skipReason = `requires csfle to run but CSFLE is not set for this environment`;
119+
skipReason = versionSupportsCSFLE
120+
? `requires csfle to run but CSFLE is not set for this environment`
121+
: 'requires mongodb >= 4.2 to run csfle tests';
118122
}
119123
} else {
120-
ok &&= config.clientSideEncryption.enabled;
121-
124+
ok &&= !(csfleEnabled && versionSupportsCSFLE);
122125
if (!ok && skipReason == null) {
123-
skipReason = `forbids csfle but CSFLE is set for this environment`;
126+
skipReason = versionSupportsCSFLE
127+
? `forbids csfle to run but CSFLE is set for this environment`
128+
: 'forbids mongodb >= 4.2 to run csfle tests';
124129
}
125130
}
126131
}

0 commit comments

Comments
 (0)