Skip to content

test(NODE-6028): skip atlas connectivity free tier 4.4 #4041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"check:test": "mocha --config test/mocha_mongodb.json test/integration",
"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:atlas": "mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.ts",
"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",
Expand Down
50 changes: 0 additions & 50 deletions test/manual/atlas_connectivity.test.js

This file was deleted.

61 changes: 61 additions & 0 deletions test/manual/atlas_connectivity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { LEGACY_HELLO_COMMAND, MongoClient } from '../mongodb';

/**
* ATLAS_CONNECTIVITY env variable is JSON
* Here's some typescript describing the shape:
*
* ```typescript
* interface AtlasConnectivity {
* [atlasDeployment: string]: [normalUri: string, srvUri: string]
* }
* ```
*
* It should be an object with descriptive strings about the deployment type and version (i.e. sharded_cluster_3_4)
* that map to a two string tuple that are the normal URI and SRV URI, order doesn't matter, but it should be that order.
*/

describe('Atlas Connectivity', function () {
const { ATLAS_CONNECTIVITY = '' } = process.env;
if (ATLAS_CONNECTIVITY === '') throw new Error('ATLAS_CONNECTIVITY not defined in env');

const CONFIGS: Record<string, [normalUri: string, srvUri: string]> =
JSON.parse(ATLAS_CONNECTIVITY);

let client: MongoClient;

afterEach(async function () {
await client.close();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulled the close up to an after each

});

for (const configName of Object.keys(CONFIGS)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forEach -> for-of

context(configName, function () {
for (const connectionString of CONFIGS[configName]) {
const name = connectionString.includes('mongodb+srv') ? 'mongodb+srv' : 'normal';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indexOf -> includes


beforeEach(function () {
if (configName === 'replica_set_4_4_free') {
const today = new Date();
// Making this April 1st so it is a monday
const april1st2024 = new Date('2024-04-01');
if (today < april1st2024) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kinda fun TBH, if the upgrade doesn't happen we'll go red again otherwise this will just become dead code and we'll start testing it again 😎

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

if (this.currentTest)
this.currentTest.skipReason =
'TODO(NODE-6027): Un-skip replica_set_4_4_free after March 29th 2024';
this.skip();
}
}
});

it(name, async function () {
this.timeout(40000);

client = new MongoClient(connectionString);

await client.connect();
await client.db('admin').command({ [LEGACY_HELLO_COMMAND]: 1 });
await client.db('test').collection('test').findOne({});
});
}
});
}
});