Skip to content

Commit eaae22c

Browse files
blink1073NoahStapp
andauthored
PYTHON-5151 Convert kms tests to use python scripts (#2158)
Co-authored-by: Noah Stapp <[email protected]>
1 parent 0ac56a3 commit eaae22c

29 files changed

+348
-291
lines changed

.evergreen/config.yml

+10-110
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
@@ -562,51 +561,6 @@ task_groups:
562561
tasks:
563562
- ".serverless"
564563

565-
- name: testgcpkms_task_group
566-
setup_group_can_fail_task: true
567-
setup_group_timeout_secs: 1800 # 30 minutes
568-
setup_group:
569-
- func: fetch source
570-
- func: setup system
571-
- command: subprocess.exec
572-
params:
573-
binary: bash
574-
args:
575-
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/create-and-setup-instance.sh
576-
teardown_task:
577-
- command: subprocess.exec
578-
params:
579-
binary: bash
580-
args:
581-
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/delete-instance.sh
582-
- func: "upload test results"
583-
tasks:
584-
- testgcpkms-task
585-
586-
- name: testazurekms_task_group
587-
setup_group:
588-
- func: fetch source
589-
- func: setup system
590-
- command: subprocess.exec
591-
params:
592-
binary: bash
593-
env:
594-
AZUREKMS_VMNAME_PREFIX: "PYTHON_DRIVER"
595-
args:
596-
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/create-and-setup-vm.sh
597-
teardown_group:
598-
- command: subprocess.exec
599-
params:
600-
binary: bash
601-
args:
602-
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/delete-vm.sh
603-
- func: "upload test results"
604-
setup_group_can_fail_task: true
605-
teardown_task_can_fail_task: true
606-
setup_group_timeout_secs: 1800
607-
tasks:
608-
- testazurekms-task
609-
610564
- name: testazureoidc_task_group
611565
setup_group:
612566
- func: fetch source
@@ -1395,60 +1349,6 @@ tasks:
13951349
commands:
13961350
- func: "download and merge coverage"
13971351

1398-
- name: "testgcpkms-task"
1399-
commands:
1400-
- command: subprocess.exec
1401-
type: test
1402-
params:
1403-
working_dir: "src"
1404-
binary: bash
1405-
include_expansions_in_env: ["DRIVERS_TOOLS"]
1406-
args:
1407-
- .evergreen/run-gcpkms-test.sh
1408-
1409-
- name: "testgcpkms-fail-task"
1410-
# testgcpkms-fail-task runs in a non-GCE environment.
1411-
# It is expected to fail to obtain GCE credentials.
1412-
commands:
1413-
- func: "bootstrap mongo-orchestration"
1414-
vars:
1415-
VERSION: "latest"
1416-
TOPOLOGY: "server"
1417-
- command: subprocess.exec
1418-
type: test
1419-
params:
1420-
include_expansions_in_env: ["PYTHON_BINARY"]
1421-
working_dir: "src"
1422-
binary: "bash"
1423-
args:
1424-
- .evergreen/scripts/run-gcpkms-fail-test.sh
1425-
1426-
- name: testazurekms-task
1427-
commands:
1428-
- command: subprocess.exec
1429-
type: test
1430-
params:
1431-
binary: bash
1432-
working_dir: src
1433-
include_expansions_in_env: ["DRIVERS_TOOLS"]
1434-
args:
1435-
- .evergreen/run-azurekms-test.sh
1436-
1437-
- name: testazurekms-fail-task
1438-
commands:
1439-
- func: "bootstrap mongo-orchestration"
1440-
vars:
1441-
VERSION: "latest"
1442-
TOPOLOGY: "server"
1443-
- command: subprocess.exec
1444-
type: test
1445-
params:
1446-
binary: bash
1447-
working_dir: src
1448-
include_expansions_in_env: ["DRIVERS_TOOLS"]
1449-
args:
1450-
- .evergreen/run-azurekms-fail-test.sh
1451-
14521352
- name: "perf-6.0-standalone"
14531353
tags: ["perf"]
14541354
commands:
@@ -1529,12 +1429,12 @@ buildvariants:
15291429
run_on:
15301430
- debian11-small
15311431
tasks:
1532-
- name: testgcpkms_task_group
1432+
- name: test-gcpkms
15331433
batchtime: 20160 # Use a batchtime of 14 days as suggested by the CSFLE test README
1534-
- testgcpkms-fail-task
1535-
- name: testazurekms_task_group
1434+
- name: test-gcpkms-fail
1435+
- name: test-azurekms
15361436
batchtime: 20160 # Use a batchtime of 14 days as suggested by the CSFLE test README
1537-
- testazurekms-fail-task
1437+
- name: test-azurekms-fail
15381438

15391439
- name: rhel8-test-lambda
15401440
display_name: FaaS Lambda

.evergreen/generated_configs/tasks.yml

+28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
tasks:
2+
# Kms tests
3+
- name: test-gcpkms
4+
commands:
5+
- func: run tests
6+
vars:
7+
TEST_NAME: kms
8+
SUB_TEST_NAME: gcp
9+
- name: test-gcpkms-fail
10+
commands:
11+
- func: bootstrap mongo-orchestration
12+
- func: run tests
13+
vars:
14+
TEST_NAME: kms
15+
SUB_TEST_NAME: gcp-fail
16+
- name: test-azurekms
17+
commands:
18+
- func: run tests
19+
vars:
20+
TEST_NAME: kms
21+
SUB_TEST_NAME: azure
22+
- name: test-azurekms-fail
23+
commands:
24+
- func: bootstrap mongo-orchestration
25+
- func: run tests
26+
vars:
27+
TEST_NAME: kms
28+
SUB_TEST_NAME: azure-fail
29+
230
# Load balancer tests
331
- name: test-load-balancer-auth-ssl
432
commands:

.evergreen/run-azurekms-fail-test.sh

-9
This file was deleted.

.evergreen/run-azurekms-test.sh

-27
This file was deleted.

.evergreen/run-gcpkms-test.sh

-24
This file was deleted.

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

+2-2
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

+2-2
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

+2-2
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

+1-1
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/__init__.py

Whitespace-only changes.

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ if [ -z "${TEST_CRYPT_SHARED:-}" ]; then
3434
export SKIP_CRYPT_SHARED=1
3535
fi
3636

37-
MONGODB_VERSION=${VERSION} \
38-
TOPOLOGY=${TOPOLOGY} \
39-
AUTH=${AUTH:-noauth} \
40-
SSL=${SSL:-nossl} \
37+
MONGODB_VERSION=${VERSION:-} \
38+
TOPOLOGY=${TOPOLOGY:-} \
39+
AUTH=${AUTH:-} \
40+
SSL=${SSL:-} \
4141
STORAGE_ENGINE=${STORAGE_ENGINE:-} \
4242
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS:-} \
4343
ORCHESTRATION_FILE=${ORCHESTRATION_FILE:-} \

.evergreen/scripts/cleanup.sh

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#!/bin/bash
22

3-
if [ -f "$DRIVERS_TOOLS"/.evergreen/csfle/secrets-export.sh ]; then
4-
bash .evergreen/teardown-encryption.sh
5-
fi
63
rm -rf "${DRIVERS_TOOLS}" || true
74
rm -f ./secrets-export.sh || true

.evergreen/scripts/generate_config.py

+19
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,25 @@ def create_load_balancer_tasks():
835835
return tasks
836836

837837

838+
def create_kms_tasks():
839+
tasks = []
840+
for kms_type in ["gcp", "azure"]:
841+
for success in [True, False]:
842+
name = f"test-{kms_type}kms"
843+
sub_test_name = kms_type
844+
if not success:
845+
name += "-fail"
846+
sub_test_name += "-fail"
847+
commands = []
848+
if not success:
849+
commands.append(FunctionCall(func="bootstrap mongo-orchestration"))
850+
test_vars = dict(TEST_NAME="kms", SUB_TEST_NAME=sub_test_name)
851+
test_func = FunctionCall(func="run tests", vars=test_vars)
852+
commands.append(test_func)
853+
tasks.append(EvgTask(name=name, commands=commands))
854+
return tasks
855+
856+
838857
##################
839858
# Generate Config
840859
##################

0 commit comments

Comments
 (0)