Skip to content

Commit a17f5da

Browse files
committed
refactor
1 parent 984bd87 commit a17f5da

12 files changed

+65
-52
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,13 @@ functions:
265265
DISABLE_TEST_COMMANDS, GREEN_FRAMEWORK, NO_EXT, COMPRESSORS, MONGODB_API_VERSION]
266266
binary: bash
267267
working_dir: "src"
268-
args: [.evergreen/just.sh, setup-test, "${TEST_NAME}", "${SUB_TEST_NAME}"]
268+
args: [.evergreen/just.sh, setup-tests, "${TEST_NAME}", "${SUB_TEST_NAME}"]
269269
- command: subprocess.exec
270270
type: test
271271
params:
272272
working_dir: "src"
273273
binary: bash
274-
args: [.evergreen/just.sh, test-eg]
274+
args: [.evergreen/just.sh, run-tests]
275275

276276
"run enterprise auth tests":
277277
- command: subprocess.exec
@@ -443,13 +443,12 @@ functions:
443443
binary: bash
444444
working_dir: "src"
445445
args:
446-
- ${DRIVERS_TOOLS}/.evergreen/csfle/teardown.sh
446+
- ${DRIVERS_TOOLS}/.evergreen/ocsp/teardown.sh
447447
- command: subprocess.exec
448448
params:
449-
binary: bash
450-
working_dir: "src"
451-
args:
452-
- ${DRIVERS_TOOLS}/.evergreen/ocsp/teardown.sh
449+
binary: bash
450+
working_dir: "src"
451+
args: [.evergreen/just.sh, teardown-tests]
453452
- command: subprocess.exec
454453
params:
455454
binary: bash

.evergreen/run-mongodb-aws-ecs-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ export SET_XTRACE_ON=1
3030
cd src
3131
rm -rf .venv
3232
rm -f .evergreen/scripts/test-env.sh || true
33-
bash ./.evergreen/just.sh setup-test auth_aws ecs
34-
bash .evergreen/just.sh test-eg
33+
bash ./.evergreen/just.sh setup-tests auth_aws ecs
34+
bash .evergreen/just.sh run-tests

.evergreen/run-mongodb-oidc-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ else
2929
exit 1
3030
fi
3131

32-
COVERAGE=1 bash ./.evergreen/just.sh setup-test auth_oidc
33-
bash ./.evergreen/just.sh test-eg "${@:1}"
32+
COVERAGE=1 bash ./.evergreen/just.sh setup-tests auth_oidc
33+
bash ./.evergreen/just.sh run-tests "${@:1}"

.evergreen/run-perf-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export OUTPUT_FILE="${PROJECT_DIRECTORY}/results.json"
1515

1616
export PYTHON_BINARY=/opt/mongodbtoolchain/v4/bin/python3
1717

18-
bash ./.evergreen/just.sh setup-test perf
19-
bash ./.evergreen/just.sh test-eg
18+
bash ./.evergreen/just.sh setup-tests perf
19+
bash ./.evergreen/just.sh run-tests

.evergreen/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [ -f $SCRIPT_DIR/scripts/test-env.sh ]; then
2020
echo "Sourcing test inputs"
2121
. $SCRIPT_DIR/scripts/test-env.sh
2222
else
23-
echo "Missing test inputs, please run 'just setup-test'"
23+
echo "Missing test inputs, please run 'just setup-tests'"
2424
exit 1
2525
fi
2626

.evergreen/scripts/run-atlas-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
set +x
55
set -o errexit
66
bash "${DRIVERS_TOOLS}"/.evergreen/auth_aws/setup_secrets.sh drivers/atlas_connect
7-
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh setup-test atlas
8-
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh test-eg
7+
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh setup-tests atlas
8+
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh reun-tests

.evergreen/scripts/run-enterprise-auth-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ set -eu
55
set +x
66
# Use the default python to bootstrap secrets.
77
bash "${DRIVERS_TOOLS}"/.evergreen/secrets_handling/setup-secrets.sh drivers/enterprise_auth
8-
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh setup-test enterprise_auth
9-
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh test-eg
8+
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh setup-tests enterprise_auth
9+
bash "${PROJECT_DIRECTORY}"/.evergreen/just.sh run-tests

.evergreen/scripts/run-mongodb-aws-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ echo "Running MONGODB-AWS authentication tests for $1"
2424
# Handle credentials and environment setup.
2525
. "$DRIVERS_TOOLS"/.evergreen/auth_aws/aws_setup.sh "$1"
2626

27-
bash ./.evergreen/just.sh setup-test auth_aws $1
28-
bash ./.evergreen/just.sh test-eg
27+
bash ./.evergreen/just.sh setup-tests auth_aws $1
28+
bash ./.evergreen/just.sh run-tests

.evergreen/scripts/teardown-tests.sh

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,29 @@
22
set -eu
33

44
SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
5-
ROOT_DIR="$(dirname "$(dirname $SCRIPT_DIR)")"
5+
SCRIPT_DIR="$( cd -- "$SCRIPT_DIR" > /dev/null 2>&1 && pwd )"
6+
ROOT_DIR="$(dirname $SCRIPT_DIR)"
67

7-
# Remove temporary test files.
88
pushd $ROOT_DIR > /dev/null
9-
rm -rf libmongocrypt/ libmongocrypt.tar.gz mongocryptd.pid > /dev/null
10-
popd > /dev/null
119

12-
if [ ! -f $SCRIPT_DIR/test-env.sh ]; then
13-
exit 0
10+
# Try to source the env file.
11+
if [ -f $SCRIPT_DIR/scripts/env.sh ]; then
12+
echo "Sourcing env inputs"
13+
. $SCRIPT_DIR/scripts/env.sh
14+
else
15+
echo "Not sourcing env inputs"
1416
fi
15-
if [ -f $SCRIPT_DIR/env.sh ]; then
16-
source $SCRIPT_DIR/env.sh
17-
fi
18-
19-
source $SCRIPT_DIR/test-env.sh
2017

21-
# Shut down csfle servers if applicable
22-
if [ -n "${TEST_ENCRYPTION:-}" ]; then
23-
bash ${DRIVERS_TOOLS}/.evergreen/csfle/stop-servers.sh
18+
# Handle test inputs.
19+
if [ -f $SCRIPT_DIR/scripts/test-env.sh ]; then
20+
echo "Sourcing test inputs"
21+
. $SCRIPT_DIR/scripts/test-env.sh
22+
else
23+
echo "Missing test inputs, please run 'just setup-test'"
24+
exit 1
2425
fi
2526

26-
# Shut down load balancer if applicable.
27-
if [ -n "${TEST_LOAD_BALANCER:-}" ]; then
28-
bash "${DRIVERS_TOOLS}"/.evergreen/run-load-balancer.sh stop
29-
fi
27+
# Start the test runner.
28+
uv run $SCRIPT_DIR/teardown_tests.py
3029

31-
# TODO: move this to a python file.
32-
if [ "TEST_NAME" == "kms" ]; then
33-
if "gcp":
34-
bash ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/teardown.sh
35-
else:
36-
${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/teardown.sh
30+
popd /dev/null

.evergreen/scripts/teardown_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from __future__ import annotations
2+
3+
import os
4+
5+
from utils import DRIVERS_TOOLS, run_command
6+
7+
TEST_NAME = os.environ["TEST_NAME"]
8+
SUB_TEST_NAME = os.environ["SUB_TEST_NAME"]
9+
10+
# Shut down csfle servers if applicable
11+
if TEST_NAME == "encryption":
12+
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/csfle/stop-servers.sh")
13+
14+
# Shut down load balancer if applicable.
15+
elif TEST_NAME == "load-balancer":
16+
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh stop")
17+
18+
# Tear down kms VM if applicable.
19+
elif TEST_NAME == "kms" and SUB_TEST_NAME in ["azure", "gcp"]:
20+
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/csfle/{SUB_TEST_NAME}kms/teardown.sh")

0 commit comments

Comments
 (0)