Skip to content

Commit 4855ab3

Browse files
committed
chore: version filter
1 parent 3f20c8f commit 4855ab3

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

test/integration/client-side-encryption/client_side_encryption.prose.25.lookup.test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as fs from 'node:fs/promises';
22
import * as path from 'node:path';
33

44
import { expect } from 'chai';
5+
import { type Test } from 'mocha';
56
import { type MongoCryptOptions } from 'mongodb-client-encryption';
67
import * as sinon from 'sinon';
78

@@ -44,6 +45,14 @@ const newEncryptedClient = ({ configuration }: { configuration: TestConfiguratio
4445

4546
describe('$lookup support', defaultMetadata, function () {
4647
before(async function () {
48+
if (
49+
this.configuration.filters.MongoDBVersionFilter.filter({
50+
metadata: defaultMetadata
51+
} as unknown as Test)
52+
) {
53+
return;
54+
}
55+
4756
let client: MongoClient, encryptedClient: MongoClient;
4857
try {
4958
/** Create an unencrypted MongoClient. */

test/tools/runner/config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
type WriteConcernSettings
1414
} from '../../mongodb';
1515
import { getEnvironmentalOptions } from '../utils';
16+
import { type Filter } from './filters/filter';
1617

1718
interface ProxyParams {
1819
proxyHost?: string;
@@ -85,6 +86,7 @@ export class TestConfiguration {
8586
serverApi?: ServerApi;
8687
activeResources: number;
8788
isSrv: boolean;
89+
filters: Record<string, Filter>;
8890

8991
constructor(
9092
private uri: string,
@@ -129,6 +131,11 @@ export class TestConfiguration {
129131
password: url.password
130132
};
131133
}
134+
135+
this.filters = Object.fromEntries(
136+
context.filters.map(filter => [filter.constructor.name, filter])
137+
);
138+
132139
if (context.serverlessCredentials) {
133140
const { username, password } = context.serverlessCredentials;
134141
this.options.auth = { username, password, authSource: 'admin' };

test/tools/runner/hooks/configuration.ts

+16-14
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,22 @@ async function initializeFilters(client): Promise<Record<string, any>> {
5151
return {};
5252
}
5353
initializedFilters = true;
54-
const context = {};
55-
56-
for (const filter of [
57-
new ApiVersionFilter(),
58-
new AuthFilter(),
59-
new ClientSideEncryptionFilter(),
60-
new GenericPredicateFilter(),
61-
new IDMSMockServerFilter(),
62-
new MongoDBTopologyFilter(),
63-
new MongoDBVersionFilter(),
64-
new NodeVersionFilter(),
65-
new OSFilter(),
66-
new ServerlessFilter()
67-
]) {
54+
const context = {
55+
filters: [
56+
new ApiVersionFilter(),
57+
new AuthFilter(),
58+
new ClientSideEncryptionFilter(),
59+
new GenericPredicateFilter(),
60+
new IDMSMockServerFilter(),
61+
new MongoDBTopologyFilter(),
62+
new MongoDBVersionFilter(),
63+
new NodeVersionFilter(),
64+
new OSFilter(),
65+
new ServerlessFilter()
66+
]
67+
};
68+
69+
for (const filter of context.filters) {
6870
filters.push(filter);
6971
await filter.initializeFilter(client, context);
7072
}

0 commit comments

Comments
 (0)