Skip to content

Commit

Permalink
test(NODE-3049): drivers atlas testing
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Aug 10, 2023
1 parent 0c5c0b4 commit dc00609
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"check:unit": "mocha test/unit",
"check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
"check:atlas": "mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.js",
"check:drivers-atlas-testing": "mocha --config test/mocha_mongodb.json test/atlas/drivers_atlas_testing.test.ts",
"check:adl": "mocha --config test/mocha_mongodb.json test/manual/atlas-data-lake-testing",
"check:aws": "nyc mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_aws.test.ts",
"check:oidc": "mocha --config test/mocha_mongodb.json test/manual/mongodb_oidc.prose.test.ts",
Expand Down
20 changes: 20 additions & 0 deletions test/atlas/drivers_atlas_testing.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { writeFile } from 'node:fs/promises';

import * as path from 'path';

import { runUnifiedSuite } from '../tools/unified-spec-runner/runner';

describe('Node Driver Atlas Testing', async function () {
console.log('process.env', process.env);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const spec = JSON.parse(process.env.WORKLOAD_SPECIFICATION!);
// TODO: Write JSON output.
// Write the events.json to the execution directory.
// JSON.stringify({ events: [], errors: [], failures: [] })
runUnifiedSuite([spec]);
// Write the results.json to the execution directory.
await writeFile(
path.join(process.env.OUTPUT_DIRECTORY ?? '', 'results.json'),
JSON.stringify({ numErrors: 0, numFailures: 0, numSuccesses: 0, numIterations: 0 })
);
});
4 changes: 4 additions & 0 deletions test/tools/runner/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ export class TestConfiguration {
}

newClient(dbOptions?: string | Record<string, any>, serverOptions?: Record<string, any>) {
if (process.env.DRIVERS_ATLAS_TESTING_URI) {
return new MongoClient(process.env.DRIVERS_ATLAS_TESTING_URI);
}

serverOptions = Object.assign({}, getEnvironmentalOptions(), serverOptions);

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

0 comments on commit dc00609

Please sign in to comment.