Skip to content

Commit e045f7d

Browse files
committed
test(NODE-3049): drivers atlas testing
1 parent 0c5c0b4 commit e045f7d

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"check:unit": "mocha test/unit",
145145
"check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
146146
"check:atlas": "mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.js",
147+
"check:drivers-atlas-testing": "mocha --config test/mocha_mongodb.json test/atlas/drivers_atlas_testing.test.ts",
147148
"check:adl": "mocha --config test/mocha_mongodb.json test/manual/atlas-data-lake-testing",
148149
"check:aws": "nyc mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_aws.test.ts",
149150
"check:oidc": "mocha --config test/mocha_mongodb.json test/manual/mongodb_oidc.prose.test.ts",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { writeFile } from 'node:fs/promises';
2+
3+
import * as path from 'path';
4+
5+
import { runUnifiedSuite } from '../tools/unified-spec-runner/runner';
6+
7+
describe('Node Driver Atlas Testing', async function () {
8+
console.log('process.env', process.env);
9+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10+
const spec = JSON.parse(process.env.WORKLOAD_SPECIFICATION!);
11+
runUnifiedSuite([spec]);
12+
// Write the events.json to the execution directory.
13+
await writeFile(
14+
path.join(process.env.OUTPUT_DIRECTORY ?? '', 'events.json'),
15+
JSON.stringify({ events: [], errors: [], failures: [] })
16+
);
17+
// Write the results.json to the execution directory.
18+
await writeFile(
19+
path.join(process.env.OUTPUT_DIRECTORY ?? '', 'results.json'),
20+
JSON.stringify({ numErrors: 0, numFailures: 0, numSuccesses: 0, numIterations: 0 })
21+
);
22+
});

test/tools/runner/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ export class TestConfiguration {
158158
}
159159

160160
newClient(dbOptions?: string | Record<string, any>, serverOptions?: Record<string, any>) {
161+
if (process.env.DRIVERS_ATLAS_TESTING_URI) {
162+
return new MongoClient(process.env.DRIVERS_ATLAS_TESTING_URI);
163+
}
164+
161165
serverOptions = Object.assign({}, getEnvironmentalOptions(), serverOptions);
162166

163167
// support MongoClient constructor form (url, options) for `newClient`

0 commit comments

Comments
 (0)