File tree 7 files changed +86
-89
lines changed
7 files changed +86
-89
lines changed Original file line number Diff line number Diff line change @@ -434,29 +434,23 @@ functions:
434
434
rm -rf ./node_modules/@aws-sdk/credential-providers
435
435
436
436
" run atlas tests " :
437
- - command : shell.exec
438
- type : test
437
+ # This creates secrets-export.sh, which is later sourced by run-tests.sh
438
+ - command : subprocess.exec
439
439
params :
440
- silent : true
441
440
working_dir : " src"
442
- script : |
443
- cat <<EOT > prepare_atlas_connectivity.sh
444
- export ATLAS_CONNECTIVITY='${ATLAS_CONNECTIVITY}'
445
- EOT
446
- - command : shell .exec
441
+ binary : bash
442
+ args :
443
+ - -c
444
+ - ${DRIVERS_TOOLS}/.evergreen/secrets_handling/setup-secrets.sh drivers/atlas_connect
445
+ - command : subprocess .exec
447
446
type : test
448
447
params :
449
448
working_dir : " src"
450
- script : |
451
- # Disable xtrace (just in case it was accidentally set).
452
- set +x
453
- . ./prepare_atlas_connectivity.sh
454
- rm -f ./prepare_atlas_connectivity.sh
455
-
456
- export PROJECT_DIRECTORY="$(pwd)"
457
- export NODE_LTS_VERSION='${NODE_LTS_VERSION}'
458
-
459
- bash ${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh
449
+ binary : bash
450
+ env :
451
+ NODE_LTS_VERSION : ${NODE_LTS_VERSION}
452
+ args :
453
+ - .evergreen/run-atlas-tests.sh
460
454
461
455
" run socks5 tests " :
462
456
- command : shell.exec
Original file line number Diff line number Diff line change @@ -389,29 +389,22 @@ functions:
389
389
source "${PROJECT_DIRECTORY}/.evergreen/init-node-and-npm-env.sh"
390
390
rm -rf ./node_modules/@aws-sdk/credential-providers
391
391
run atlas tests :
392
- - command : shell.exec
393
- type : test
392
+ - command : subprocess.exec
394
393
params :
395
- silent : true
396
394
working_dir : src
397
- script : |
398
- cat <<EOT > prepare_atlas_connectivity.sh
399
- export ATLAS_CONNECTIVITY='${ATLAS_CONNECTIVITY} '
400
- EOT
401
- - command : shell .exec
395
+ binary : bash
396
+ args :
397
+ - ' -c '
398
+ - ${DRIVERS_TOOLS}/.evergreen/secrets_handling/setup-secrets.sh drivers/atlas_connect
399
+ - command : subprocess .exec
402
400
type : test
403
401
params :
404
402
working_dir : src
405
- script : |
406
- # Disable xtrace (just in case it was accidentally set).
407
- set +x
408
- . ./prepare_atlas_connectivity.sh
409
- rm -f ./prepare_atlas_connectivity.sh
410
-
411
- export PROJECT_DIRECTORY="$(pwd)"
412
- export NODE_LTS_VERSION='${NODE_LTS_VERSION}'
413
-
414
- bash ${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh
403
+ binary : bash
404
+ env :
405
+ NODE_LTS_VERSION : ${NODE_LTS_VERSION}
406
+ args :
407
+ - .evergreen/run-atlas-tests.sh
415
408
run socks5 tests :
416
409
- command : shell.exec
417
410
type : test
Original file line number Diff line number Diff line change 2
2
3
3
set -o errexit # Exit the script with error if any of the commands fail
4
4
5
- source " ${PROJECT_DIRECTORY} /.evergreen/init-node-and-npm-env.sh"
5
+ if test -f secrets-export.sh; then
6
+ source secrets-export.sh
7
+ fi
6
8
7
- set -o xtrace
9
+ PROJECT_DIRECTORY=${PROJECT_DIRECTORY:- " ." }
10
+ source " ${PROJECT_DIRECTORY} /.evergreen/init-node-and-npm-env.sh"
8
11
9
12
node -v
10
13
Original file line number Diff line number Diff line change @@ -99,3 +99,9 @@ test/lambda/env.json
99
99
! encryption /lib
100
100
! encryption /test
101
101
! encryption /test /types
102
+
103
+ # files generated by tooling in drivers-evergreen-tools
104
+ secrets-export.sh
105
+ mo-expansion.sh
106
+ mo-expansion.yml
107
+ expansions.sh
Original file line number Diff line number Diff line change 133
133
"check:test" : " mocha --config test/mocha_mongodb.json test/integration" ,
134
134
"check:unit" : " mocha test/unit" ,
135
135
"check:ts" : " node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit" ,
136
- "check:atlas" : " mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.js " ,
136
+ "check:atlas" : " mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.ts " ,
137
137
"check:adl" : " mocha --config test/mocha_mongodb.json test/manual/atlas-data-lake-testing" ,
138
138
"check:aws" : " nyc mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_aws.test.ts" ,
139
139
"check:oidc" : " mocha --config test/mocha_mongodb.json test/manual/mongodb_oidc.prose.test.ts" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ let client : MongoClient ;
19
+
20
+ afterEach ( async function ( ) {
21
+ await client ?. close ( ) ;
22
+ } ) ;
23
+
24
+ const environments = [
25
+ 'ATLAS_SERVERLESS' ,
26
+ 'ATLAS_SRV_SERVERLESS' ,
27
+ 'ATLAS_FREE' ,
28
+ 'ATLAS_SRV_FREE' ,
29
+ 'ATLAS_REPL' ,
30
+ 'ATLAS_SRV_REPL' ,
31
+ 'ATLAS_SHRD' ,
32
+ 'ATLAS_SRV_SHRD' ,
33
+ 'ATLAS_TLS11' ,
34
+ 'ATLAS_SRV_TLS11' ,
35
+ 'ATLAS_TLS12' ,
36
+ 'ATLAS_SRV_TLS12'
37
+ ] ;
38
+
39
+ for ( const environment of environments ) {
40
+ it ( `${ environment } connects successfully` , async function ( ) {
41
+ this . timeout ( 40000 ) ;
42
+
43
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
44
+ client = new MongoClient ( process . env [ environment ] ! ) ;
45
+
46
+ await client . connect ( ) ;
47
+ await client . db ( 'admin' ) . command ( { [ LEGACY_HELLO_COMMAND ] : 1 } ) ;
48
+ await client . db ( 'test' ) . collection ( 'test' ) . findOne ( { } ) ;
49
+ } ) ;
50
+ }
51
+ } ) ;
You can’t perform that action at this time.
0 commit comments