Skip to content

Commit 0209cfe

Browse files
committed
test(NODE-6028): skip atlas connectivity free tier 4.4
1 parent d86d2ae commit 0209cfe

File tree

3 files changed

+68
-51
lines changed

3 files changed

+68
-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: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
if (process.env.ATLAS_CONNECTIVITY == null) {
19+
console.error(
20+
'skipping atlas connectivity tests, ATLAS_CONNECTIVITY environment variable is not defined'
21+
);
22+
23+
return;
24+
}
25+
26+
const CONFIGS: Record<string, [normalUri: string, srvUri: string]> = JSON.parse(
27+
process.env.ATLAS_CONNECTIVITY
28+
);
29+
30+
let client;
31+
32+
afterEach(async function () {
33+
await client.close();
34+
});
35+
36+
for (const configName of Object.keys(CONFIGS)) {
37+
context(configName, function () {
38+
for (const connectionString of CONFIGS[configName]) {
39+
const name = connectionString.includes('mongodb+srv') ? 'mongodb+srv' : 'normal';
40+
41+
beforeEach(function () {
42+
if (configName === 'replica_set_4_4_free') {
43+
const today = new Date();
44+
// Making this April 1st so it is a monday
45+
const april1st2024 = new Date('2024-04-01');
46+
if (today < april1st2024) {
47+
if (this.currentTest)
48+
this.currentTest.skipReason =
49+
'TODO(NODE-6027): Un-skip replica_set_4_4_free after March 29th 2024';
50+
this.skip();
51+
}
52+
}
53+
});
54+
55+
it(name, async function () {
56+
this.timeout(40000);
57+
58+
client = new MongoClient(connectionString);
59+
60+
await client.connect();
61+
await client.db('admin').command({ [LEGACY_HELLO_COMMAND]: 1 });
62+
await client.db('test').collection('test').findOne({});
63+
});
64+
}
65+
});
66+
}
67+
});

0 commit comments

Comments
 (0)