Skip to content

PYTHON-5151 Convert kms tests to use python scripts #2158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
80601f1
PYTHON-5151 Convert kms tests to use python scripts
blink1073 Feb 24, 2025
ec12424
PYTHON-5151 Convert kms tests to use python scripts
blink1073 Feb 24, 2025
e429e09
fix task names
blink1073 Feb 24, 2025
984bd87
fixups
blink1073 Feb 24, 2025
a17f5da
refactor
blink1073 Feb 24, 2025
1a4944a
fix sub_test_name
blink1073 Feb 24, 2025
a5cd2b6
fix kms_setup
blink1073 Feb 24, 2025
b34f4a8
fix kms_setup
blink1073 Feb 24, 2025
5ae7bf8
fix kms_setup
blink1073 Feb 24, 2025
206c2a4
fix kms_setup
blink1073 Feb 24, 2025
07f6284
fix kms_setup
blink1073 Feb 24, 2025
6a52737
fix kms_setup
blink1073 Feb 24, 2025
bee26e1
fix kms_setup
blink1073 Feb 24, 2025
489506f
fix teardown
blink1073 Feb 24, 2025
fdc7118
fix kms_setup
blink1073 Feb 24, 2025
9df90f0
fix kms_setup
blink1073 Feb 24, 2025
969d203
fix kms_setup
blink1073 Feb 25, 2025
264c7a6
fix kms_setup
blink1073 Feb 25, 2025
9f7ec22
fix kms_setup
blink1073 Feb 25, 2025
097779f
fix kms_setup
blink1073 Feb 25, 2025
2e8cebd
fix kms_setup
blink1073 Feb 25, 2025
7b09bfc
fix azure setup
blink1073 Feb 25, 2025
cd7f043
fix azure setup
blink1073 Feb 25, 2025
50c9ee0
cleanup
blink1073 Feb 25, 2025
76cc63f
add files
blink1073 Feb 25, 2025
6168d3a
fix azure setup
blink1073 Feb 25, 2025
31d84a2
fix azure setup
blink1073 Feb 25, 2025
f51901b
fix azure setup
blink1073 Feb 25, 2025
60c6745
fix typo
blink1073 Feb 25, 2025
5be69fb
Update .evergreen/scripts/teardown-tests.sh
blink1073 Feb 25, 2025
ef195ef
Merge branch 'master' into PYTHON-5151
blink1073 Feb 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 10 additions & 110 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ functions:
DISABLE_TEST_COMMANDS, GREEN_FRAMEWORK, NO_EXT, COMPRESSORS, MONGODB_API_VERSION]
binary: bash
working_dir: "src"
args: [.evergreen/just.sh, setup-test, "${TEST_NAME}", "${SUB_TEST_NAME}"]
args: [.evergreen/just.sh, setup-tests, "${TEST_NAME}", "${SUB_TEST_NAME}"]
- command: subprocess.exec
type: test
params:
working_dir: "src"
binary: bash
args: [.evergreen/just.sh, test-eg]
args: [.evergreen/just.sh, run-tests]

"run enterprise auth tests":
- command: subprocess.exec
Expand Down Expand Up @@ -443,13 +443,12 @@ functions:
binary: bash
working_dir: "src"
args:
- ${DRIVERS_TOOLS}/.evergreen/csfle/teardown.sh
- ${DRIVERS_TOOLS}/.evergreen/ocsp/teardown.sh
- command: subprocess.exec
params:
binary: bash
working_dir: "src"
args:
- ${DRIVERS_TOOLS}/.evergreen/ocsp/teardown.sh
binary: bash
working_dir: "src"
args: [.evergreen/just.sh, teardown-tests]
- command: subprocess.exec
params:
binary: bash
Expand Down Expand Up @@ -562,51 +561,6 @@ task_groups:
tasks:
- ".serverless"

- name: testgcpkms_task_group
setup_group_can_fail_task: true
setup_group_timeout_secs: 1800 # 30 minutes
setup_group:
- func: fetch source
- func: setup system
- command: subprocess.exec
params:
binary: bash
args:
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/create-and-setup-instance.sh
teardown_task:
- command: subprocess.exec
params:
binary: bash
args:
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/delete-instance.sh
- func: "upload test results"
tasks:
- testgcpkms-task

- name: testazurekms_task_group
setup_group:
- func: fetch source
- func: setup system
- command: subprocess.exec
params:
binary: bash
env:
AZUREKMS_VMNAME_PREFIX: "PYTHON_DRIVER"
args:
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/create-and-setup-vm.sh
teardown_group:
- command: subprocess.exec
params:
binary: bash
args:
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/delete-vm.sh
- func: "upload test results"
setup_group_can_fail_task: true
teardown_task_can_fail_task: true
setup_group_timeout_secs: 1800
tasks:
- testazurekms-task

- name: testazureoidc_task_group
setup_group:
- func: fetch source
Expand Down Expand Up @@ -1395,60 +1349,6 @@ tasks:
commands:
- func: "download and merge coverage"

- name: "testgcpkms-task"
commands:
- command: subprocess.exec
type: test
params:
working_dir: "src"
binary: bash
include_expansions_in_env: ["DRIVERS_TOOLS"]
args:
- .evergreen/run-gcpkms-test.sh

- name: "testgcpkms-fail-task"
# testgcpkms-fail-task runs in a non-GCE environment.
# It is expected to fail to obtain GCE credentials.
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "latest"
TOPOLOGY: "server"
- command: subprocess.exec
type: test
params:
include_expansions_in_env: ["PYTHON_BINARY"]
working_dir: "src"
binary: "bash"
args:
- .evergreen/scripts/run-gcpkms-fail-test.sh

- name: testazurekms-task
commands:
- command: subprocess.exec
type: test
params:
binary: bash
working_dir: src
include_expansions_in_env: ["DRIVERS_TOOLS"]
args:
- .evergreen/run-azurekms-test.sh

- name: testazurekms-fail-task
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "latest"
TOPOLOGY: "server"
- command: subprocess.exec
type: test
params:
binary: bash
working_dir: src
include_expansions_in_env: ["DRIVERS_TOOLS"]
args:
- .evergreen/run-azurekms-fail-test.sh

- name: "perf-6.0-standalone"
tags: ["perf"]
commands:
Expand Down Expand Up @@ -1529,12 +1429,12 @@ buildvariants:
run_on:
- debian11-small
tasks:
- name: testgcpkms_task_group
- name: test-gcpkms
batchtime: 20160 # Use a batchtime of 14 days as suggested by the CSFLE test README
- testgcpkms-fail-task
- name: testazurekms_task_group
- name: test-gcpkms-fail
- name: test-azurekms
batchtime: 20160 # Use a batchtime of 14 days as suggested by the CSFLE test README
- testazurekms-fail-task
- name: test-azurekms-fail

- name: rhel8-test-lambda
display_name: FaaS Lambda
Expand Down
28 changes: 28 additions & 0 deletions .evergreen/generated_configs/tasks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
tasks:
# Kms tests
- name: test-gcpkms
commands:
- func: run tests
vars:
TEST_NAME: kms
SUB_TEST_NAME: gcp
- name: test-gcpkms-fail
commands:
- func: bootstrap mongo-orchestration
- func: run tests
vars:
TEST_NAME: kms
SUB_TEST_NAME: gcp-fail
- name: test-azurekms
commands:
- func: run tests
vars:
TEST_NAME: kms
SUB_TEST_NAME: azure
- name: test-azurekms-fail
commands:
- func: bootstrap mongo-orchestration
- func: run tests
vars:
TEST_NAME: kms
SUB_TEST_NAME: azure-fail

# Load balancer tests
- name: test-load-balancer-auth-ssl
commands:
Expand Down
9 changes: 0 additions & 9 deletions .evergreen/run-azurekms-fail-test.sh

This file was deleted.

27 changes: 0 additions & 27 deletions .evergreen/run-azurekms-test.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .evergreen/run-gcpkms-test.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .evergreen/run-mongodb-aws-ecs-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export SET_XTRACE_ON=1
cd src
rm -rf .venv
rm -f .evergreen/scripts/test-env.sh || true
bash ./.evergreen/just.sh setup-test auth_aws ecs
bash .evergreen/just.sh test-eg
bash ./.evergreen/just.sh setup-tests auth_aws ecs
bash .evergreen/just.sh run-tests
4 changes: 2 additions & 2 deletions .evergreen/run-mongodb-oidc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ else
exit 1
fi

COVERAGE=1 bash ./.evergreen/just.sh setup-test auth_oidc
bash ./.evergreen/just.sh test-eg "${@:1}"
COVERAGE=1 bash ./.evergreen/just.sh setup-tests auth_oidc
bash ./.evergreen/just.sh run-tests "${@:1}"
4 changes: 2 additions & 2 deletions .evergreen/run-perf-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export OUTPUT_FILE="${PROJECT_DIRECTORY}/results.json"

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

bash ./.evergreen/just.sh setup-test perf
bash ./.evergreen/just.sh test-eg
bash ./.evergreen/just.sh setup-tests perf
bash ./.evergreen/just.sh run-tests
2 changes: 1 addition & 1 deletion .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -f $SCRIPT_DIR/scripts/test-env.sh ]; then
echo "Sourcing test inputs"
. $SCRIPT_DIR/scripts/test-env.sh
else
echo "Missing test inputs, please run 'just setup-test'"
echo "Missing test inputs, please run 'just setup-tests'"
exit 1
fi

Expand Down
Empty file added .evergreen/scripts/__init__.py
Empty file.
8 changes: 4 additions & 4 deletions .evergreen/scripts/bootstrap-mongo-orchestration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ if [ -z "${TEST_CRYPT_SHARED:-}" ]; then
export SKIP_CRYPT_SHARED=1
fi

MONGODB_VERSION=${VERSION} \
TOPOLOGY=${TOPOLOGY} \
AUTH=${AUTH:-noauth} \
SSL=${SSL:-nossl} \
MONGODB_VERSION=${VERSION:-} \
TOPOLOGY=${TOPOLOGY:-} \
AUTH=${AUTH:-} \
SSL=${SSL:-} \
STORAGE_ENGINE=${STORAGE_ENGINE:-} \
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS:-} \
ORCHESTRATION_FILE=${ORCHESTRATION_FILE:-} \
Expand Down
3 changes: 0 additions & 3 deletions .evergreen/scripts/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/bin/bash

if [ -f "$DRIVERS_TOOLS"/.evergreen/csfle/secrets-export.sh ]; then
bash .evergreen/teardown-encryption.sh
fi
rm -rf "${DRIVERS_TOOLS}" || true
rm -f ./secrets-export.sh || true
19 changes: 19 additions & 0 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,25 @@ def create_load_balancer_tasks():
return tasks


def create_kms_tasks():
tasks = []
for kms_type in ["gcp", "azure"]:
for success in [True, False]:
name = f"test-{kms_type}kms"
sub_test_name = kms_type
if not success:
name += "-fail"
sub_test_name += "-fail"
commands = []
if not success:
commands.append(FunctionCall(func="bootstrap mongo-orchestration"))
test_vars = dict(TEST_NAME="kms", SUB_TEST_NAME=sub_test_name)
test_func = FunctionCall(func="run tests", vars=test_vars)
commands.append(test_func)
tasks.append(EvgTask(name=name, commands=commands))
return tasks


##################
# Generate Config
##################
Expand Down
Loading
Loading