Skip to content

Commit 69f64e7

Browse files
authored
test(NODE-4642): fix serverApi strict tests (#3436)
* test(NODE-4642): fix serverApi strict tests * fix: evg gen
1 parent f1b55db commit 69f64e7

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

.evergreen/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,9 @@ tasks:
11851185
REQUIRE_API_VERSION: '1'
11861186
AUTH: auth
11871187
- func: bootstrap kms servers
1188+
- func: run tests
1189+
vars:
1190+
MONGODB_API_VERSION: '1'
11881191
- name: test-atlas-connectivity
11891192
tags:
11901193
- atlas-connect

.evergreen/generate_evergreen_tasks.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ BASE_TASKS.push({
9797
}
9898
},
9999
{ func: 'bootstrap kms servers' },
100-
// TODO(NODE-4642): Fix versioned API tests
101-
// {
102-
// func: 'run tests',
103-
// vars: {
104-
// MONGODB_API_VERSION: '1'
105-
// }
106-
// }
100+
{
101+
func: 'run tests',
102+
vars: {
103+
MONGODB_API_VERSION: '1'
104+
}
105+
}
107106
]
108107
});
109108

test/tools/cmap_spec_runner.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,10 @@ export class ThreadContext {
299299
this.pool = new ConnectionPool(this.#server, {
300300
...this.#poolOptions,
301301
...options,
302-
hostAddress: this.#hostAddress
302+
hostAddress: this.#hostAddress,
303+
serverApi: process.env.MONGODB_API_VERSION
304+
? { version: process.env.MONGODB_API_VERSION }
305+
: undefined
303306
});
304307
this.#originalServerPool = this.#server.s.pool;
305308
this.#server.s.pool = this.pool;
@@ -370,8 +373,6 @@ async function runCmapTest(test: CmapTest, threadContext: ThreadContext) {
370373
const expectedEvents = test.events;
371374
const ignoreEvents = test.ignore || [];
372375

373-
let actualError;
374-
375376
const MAIN_THREAD_KEY = Symbol('Main Thread');
376377
const mainThread = threadContext.getThread(MAIN_THREAD_KEY);
377378
mainThread.start();
@@ -394,9 +395,7 @@ async function runCmapTest(test: CmapTest, threadContext: ThreadContext) {
394395
}
395396
}
396397

397-
await mainThread.finish().catch(e => {
398-
actualError = e;
399-
});
398+
const actualError = await mainThread.finish().catch(e => e);
400399

401400
if (expectedError) {
402401
expect(actualError).to.exist;

test/tools/runner/config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,6 @@ export class TestConfiguration {
199199
dbOptions.loadBalanced = true;
200200
}
201201

202-
if (process.env.MONGODB_API_VERSION) {
203-
dbOptions.apiVersion = process.env.MONGODB_API_VERSION;
204-
}
205-
206202
const urlOptions: url.UrlObject = {
207203
protocol: this.isServerless ? 'mongodb+srv' : 'mongodb',
208204
slashes: true,

0 commit comments

Comments
 (0)