Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Jun 10, 2024
1 parent 5bc9edb commit 226e48b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/integration/client-side-encryption/driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('Client Side Encryption Functional', function () {
let collection: Collection;

beforeEach(async function () {
if (!this.configuration.clientSideEncryption.environmentConfigured) {
if (!this.configuration.clientSideEncryption.enabled) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion test/tools/runner/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function convertToConnStringMap(obj: Record<string, any>) {
export class TestConfiguration {
version: string;
clientSideEncryption: {
environmentConfigured: boolean;
enabled: boolean;
mongodbClientEncryption: any;
CSFLE_KMS_PROVIDERS: string | undefined;
version: string;
Expand Down
5 changes: 2 additions & 3 deletions test/tools/runner/filters/client_encryption_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Filter } from './filter';

export class ClientSideEncryptionFilter extends Filter {
enabled: boolean;
environmentSetUp: boolean;
static version = null;

override async initializeFilter(client: MongoClient, context: Record<string, any>) {
Expand All @@ -43,7 +42,6 @@ export class ClientSideEncryptionFilter extends Filter {
).version;

this.enabled = !!(CSFLE_KMS_PROVIDERS && mongodbClientEncryption);
this.environmentSetUp = !!CSFLE_KMS_PROVIDERS;

// Adds these fields onto the context so that they can be reused by tests
context.clientSideEncryption = {
Expand Down Expand Up @@ -74,7 +72,8 @@ export class ClientSideEncryptionFilter extends Filter {
}
const validRange = typeof clientSideEncryption === 'string' ? clientSideEncryption : '>=0.0.0';

if (!this.environmentSetUp) return 'Test requires FLE environment variables..';
if (ClientSideEncryptionFilter.version && !this.enabled)
return 'Test requires FLE environment variables..';
if (!this.enabled) return 'Test requires CSFLE to be enabled.';
return satisfies(ClientSideEncryptionFilter.version, validRange)
? true
Expand Down
2 changes: 1 addition & 1 deletion test/tools/runner/hooks/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const testConfigBeforeHook = async function () {
auth: process.env.AUTH === 'auth',
tls: process.env.SSL === 'ssl',
csfle: {
environmentConfigured: this.configuration.clientSideEncryption.environmentConfigured,
enabled: this.configuration.clientSideEncryption.enabled,
version: this.configuration.clientSideEncryption.version
},
serverApi: MONGODB_API_VERSION,
Expand Down
2 changes: 1 addition & 1 deletion test/tools/unified-spec-runner/unified-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export async function topologySatisfies(

if (typeof r.csfle === 'boolean') {
const versionSupportsCSFLE = semverGte(config.version, '4.2.0');
const csfleEnabled = config.clientSideEncryption.environmentConfigured;
const csfleEnabled = config.clientSideEncryption.enabled;

if (r.csfle) {
ok &&= versionSupportsCSFLE && csfleEnabled;
Expand Down

0 comments on commit 226e48b

Please sign in to comment.