Skip to content

Commit 40a9984

Browse files
committed
Add setup-tests.sh
1 parent fe40a95 commit 40a9984

File tree

5 files changed

+97
-10
lines changed

5 files changed

+97
-10
lines changed

.evergreen/config.yml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ functions:
227227
- command: subprocess.exec
228228
params:
229229
binary: bash
230-
include_expansions_in_env: ["VERSION", "TOPOLOGY"]
230+
include_expansions_in_env: ["VERSION", "TOPOLOGY", "ORCHESTRATION_FILE"]
231231
args:
232232
- src/.evergreen/scripts/run-with-env.sh
233233
- src/.evergreen/scripts/bootstrap-mongo-orchestration.sh
@@ -293,6 +293,13 @@ functions:
293293
- .evergreen/scripts/run-doctests.sh
294294

295295
"run tests":
296+
- command: subprocess.exec
297+
params:
298+
include_expansions_in_env: ["TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE", "SINGLE_MONGOS_LB_URI", "MULTI_MONGOS_LB_URI"]
299+
binary: bash
300+
working_dir: "src"
301+
args:
302+
- .evergreen/scripts/setup-tests.sh
296303
- command: subprocess.exec
297304
params:
298305
working_dir: "src"
@@ -343,6 +350,13 @@ functions:
343350
- ${DRIVERS_TOOLS}/.evergreen/auth_aws/setup-secrets.sh
344351

345352
"run aws auth test with regular aws credentials":
353+
- command: subprocess.exec
354+
params:
355+
include_expansions_in_env: ["TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE"]
356+
binary: bash
357+
working_dir: "src"
358+
args:
359+
- .evergreen/scripts/setup-tests.sh
346360
- command: subprocess.exec
347361
type: test
348362
params:
@@ -355,6 +369,13 @@ functions:
355369
- regular
356370

357371
"run aws auth test with assume role credentials":
372+
- command: subprocess.exec
373+
params:
374+
include_expansions_in_env: [ "TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE" ]
375+
binary: bash
376+
working_dir: "src"
377+
args:
378+
- .evergreen/scripts/setup-tests.sh
358379
- command: subprocess.exec
359380
type: test
360381
params:
@@ -367,6 +388,13 @@ functions:
367388
- assume-role
368389

369390
"run aws auth test with aws EC2 credentials":
391+
- command: subprocess.exec
392+
params:
393+
include_expansions_in_env: [ "TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE" ]
394+
binary: bash
395+
working_dir: "src"
396+
args:
397+
- .evergreen/scripts/setup-tests.sh
370398
- command: subprocess.exec
371399
type: test
372400
params:
@@ -379,6 +407,13 @@ functions:
379407
- ec2
380408

381409
"run aws auth test with aws web identity credentials":
410+
- command: subprocess.exec
411+
params:
412+
include_expansions_in_env: [ "TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE" ]
413+
binary: bash
414+
working_dir: "src"
415+
args:
416+
- .evergreen/scripts/setup-tests.sh
382417
- # Test with and without AWS_ROLE_SESSION_NAME set.
383418
- command: subprocess.exec
384419
type: test
@@ -402,6 +437,13 @@ functions:
402437
- web-identity
403438

404439
"run aws auth test with aws credentials as environment variables":
440+
- command: subprocess.exec
441+
params:
442+
include_expansions_in_env: [ "TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE" ]
443+
binary: bash
444+
working_dir: "src"
445+
args:
446+
- .evergreen/scripts/setup-tests.sh
405447
- command: subprocess.exec
406448
type: test
407449
params:
@@ -414,6 +456,13 @@ functions:
414456
- env-creds
415457

416458
"run aws auth test with aws credentials and session token as environment variables":
459+
- command: subprocess.exec
460+
params:
461+
include_expansions_in_env: [ "TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE" ]
462+
binary: bash
463+
working_dir: "src"
464+
args:
465+
- .evergreen/scripts/setup-tests.sh
417466
- command: subprocess.exec
418467
type: test
419468
params:
@@ -426,6 +475,13 @@ functions:
426475
- session-creds
427476

428477
"run oidc auth test with test credentials":
478+
- command: subprocess.exec
479+
params:
480+
include_expansions_in_env: [ "TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE" ]
481+
binary: bash
482+
working_dir: "src"
483+
args:
484+
- .evergreen/scripts/setup-tests.sh
429485
- command: subprocess.exec
430486
type: test
431487
params:
@@ -523,6 +579,13 @@ functions:
523579
file: atlas-expansion.yml
524580

525581
"run-ocsp-test":
582+
- command: subprocess.exec
583+
params:
584+
include_expansions_in_env: [ "TEST_DATA_LAKE", "TEST_INDEX_MANAGEMENT", "CRYPT_SHARED_LIB_PATH", "test_encryption", "test_encryption_pyopenssl", "test_crypt_shared", "test_pyopenssl", "test_loadbalancer", "test_serverless", "ORCHESTRATION_FILE" ]
585+
binary: bash
586+
working_dir: "src"
587+
args:
588+
- .evergreen/scripts/setup-tests.sh
526589
- command: subprocess.exec
527590
type: test
528591
params:

.evergreen/scripts/bootstrap-mongo-orchestration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ MONGODB_VERSION=${VERSION} \
3939
SSL=${SSL} \
4040
STORAGE_ENGINE=${STORAGE_ENGINE} \
4141
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS} \
42-
ORCHESTRATION_FILE=${ORCHESTRATION_FILE} \
42+
ORCHESTRATION_FILE=${ORCHESTRATION_FILE:-} \
4343
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
4444
LOAD_BALANCER=${LOAD_BALANCER} \
4545
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh

.evergreen/scripts/configure-env.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,8 @@ export MONGODB_API_VERSION="${MONGODB_API_VERSION:-}"
5454
export SKIP_HATCH="${SKIP_HATCH:-}"
5555
export skip_crypt_shared="${skip_crypt_shared:-}"
5656
export STORAGE_ENGINE="${STORAGE_ENGINE:-}"
57-
export ORCHESTRATION_FILE="${ORCHESTRATION_FILE:-}"
5857
export REQUIRE_API_VERSION="${REQUIRE_API_VERSION:-}"
5958
export LOAD_BALANCER="${LOAD_BALANCER:-}"
60-
test_encryption="${test_encryption:-}"
61-
test_encryption_pyopenssl="${test_encryption_pyopenssl:-}"
62-
test_crypt_shared="${test_crypt_shared:-}"
63-
test_pyopenssl="${test_pyopenssl:-}"
64-
test_loadbalancer="${test_loadbalancer:-}"
65-
test_serverless="${test_serverless:-}"
6659
6760
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
6861
export PATH="$MONGODB_BINARIES:$PATH"

.evergreen/scripts/run-with-env.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
#!/bin/bash
1+
#!/bin/bash -eu
22

33
# Example use: bash run-with-env.sh run-tests.sh {args...}
44

55
# Parameter expansion to get just the current directory's name
66
if [ "${PWD##*/}" == "src" ]; then
77
. .evergreen/scripts/env.sh
8+
if [ -f ".evergreen/scripts/test-env.sh" ]; then
9+
. .evergreen/scripts/test-env.sh
10+
fi
811
else
912
. src/.evergreen/scripts/env.sh
13+
if [ -f "src/.evergreen/scripts/test-env.sh" ]; then
14+
. src/.evergreen/scripts/test-env.sh
15+
fi
1016
fi
1117

1218
set -eu

.evergreen/scripts/setup-tests.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash -eux
2+
3+
PROJECT_DIRECTORY="$(pwd)"
4+
SCRIPT_DIR="$PROJECT_DIRECTORY/.evergreen/scripts"
5+
6+
if [ -f "$SCRIPT_DIR/test-env.sh" ]; then
7+
echo "Reading $SCRIPT_DIR/test-env.sh file"
8+
. "$SCRIPT_DIR/test-env.sh"
9+
exit 0
10+
fi
11+
12+
cat <<EOT > "$SCRIPT_DIR"/test-env.sh
13+
echo "Sourcing test-env.sh now, ORCHESTRATION_FILE: $ORCHESTRATION_FILE"
14+
export test_encryption="${test_encryption:-}"
15+
export test_encryption_pyopenssl="${test_encryption_pyopenssl:-}"
16+
export test_crypt_shared="${test_crypt_shared:-}"
17+
export test_pyopenssl="${test_pyopenssl:-}"
18+
export test_loadbalancer="${test_loadbalancer:-}"
19+
export test_serverless="${test_serverless:-}"
20+
export TEST_INDEX_MANAGEMENT="${TEST_INDEX_MANAGEMENT:-}"
21+
export TEST_DATA_LAKE="${TEST_DATA_LAKE:-}"
22+
export ORCHESTRATION_FILE="${ORCHESTRATION_FILE:-}"
23+
EOT
24+
25+
chmod +x "$SCRIPT_DIR"/test-env.sh

0 commit comments

Comments
 (0)