Skip to content

Commit 024e487

Browse files
authored
test(NODE-6028): skip atlas connectivity free tier 4.4 (#4041)
1 parent 159ea81 commit 024e487

File tree

3 files changed

+62
-51
lines changed

3 files changed

+62
-51
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"check:test": "mocha --config test/mocha_mongodb.json test/integration",
144144
"check:unit": "mocha test/unit",
145145
"check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
146-
"check:atlas": "mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.js",
146+
"check:atlas": "mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.ts",
147147
"check:drivers-atlas-testing": "mocha --config test/mocha_mongodb.json test/atlas/drivers_atlas_testing.test.ts",
148148
"check:adl": "mocha --config test/mocha_mongodb.json test/manual/atlas-data-lake-testing",
149149
"check:aws": "nyc mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_aws.test.ts",

test/manual/atlas_connectivity.test.js

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { LEGACY_HELLO_COMMAND, MongoClient } from '../mongodb';
2+
3+
/**
4+
* ATLAS_CONNECTIVITY env variable is JSON
5+
* Here's some typescript describing the shape:
6+
*
7+
* ```typescript
8+
* interface AtlasConnectivity {
9+
* [atlasDeployment: string]: [normalUri: string, srvUri: string]
10+
* }
11+
* ```
12+
*
13+
* It should be an object with descriptive strings about the deployment type and version (i.e. sharded_cluster_3_4)
14+
* 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.
15+
*/
16+
17+
describe('Atlas Connectivity', function () {
18+
const { ATLAS_CONNECTIVITY = '' } = process.env;
19+
if (ATLAS_CONNECTIVITY === '') throw new Error('ATLAS_CONNECTIVITY not defined in env');
20+
21+
const CONFIGS: Record<string, [normalUri: string, srvUri: string]> =
22+
JSON.parse(ATLAS_CONNECTIVITY);
23+
24+
let client: MongoClient;
25+
26+
afterEach(async function () {
27+
await client.close();
28+
});
29+
30+
for (const configName of Object.keys(CONFIGS)) {
31+
context(configName, function () {
32+
for (const connectionString of CONFIGS[configName]) {
33+
const name = connectionString.includes('mongodb+srv') ? 'mongodb+srv' : 'normal';
34+
35+
beforeEach(function () {
36+
if (configName === 'replica_set_4_4_free') {
37+
const today = new Date();
38+
// Making this April 1st so it is a monday
39+
const april1st2024 = new Date('2024-04-01');
40+
if (today < april1st2024) {
41+
if (this.currentTest)
42+
this.currentTest.skipReason =
43+
'TODO(NODE-6027): Un-skip replica_set_4_4_free after March 29th 2024';
44+
this.skip();
45+
}
46+
}
47+
});
48+
49+
it(name, async function () {
50+
this.timeout(40000);
51+
52+
client = new MongoClient(connectionString);
53+
54+
await client.connect();
55+
await client.db('admin').command({ [LEGACY_HELLO_COMMAND]: 1 });
56+
await client.db('test').collection('test').findOne({});
57+
});
58+
}
59+
});
60+
}
61+
});

0 commit comments

Comments
 (0)