Skip to content

Commit 0495cc8

Browse files
committed
avoid encryption tasks on non-encrypted builds
1 parent 59a4cd4 commit 0495cc8

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.evergreen/config.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ functions:
5959
args:
6060
- ./.evergreen/run-tests.sh
6161

62+
"run encryption tests":
63+
- command: subprocess.exec
64+
type: test
65+
params:
66+
binary: bash
67+
working_dir: "src"
68+
include_expansions_in_env: ["DRIVERS_TOOLS", "MONGODB_URI", "DJANGO_SETTINGS_MODULE", "CRYPT_SHARED_LIB_PATH"]
69+
args:
70+
- ./.evergreen/run-tests.sh
71+
- encryption
72+
6273
"teardown":
6374
- command: subprocess.exec
6475
params:
@@ -80,6 +91,10 @@ tasks:
8091
commands:
8192
- func: "run unit tests"
8293

94+
- name: run-encryption-tests
95+
commands:
96+
- func: "run encryption tests"
97+
8398
buildvariants:
8499
- name: tests-6-noauth-nossl
85100
display_name: Run Tests 6.0 NoAuth NoSSL
@@ -133,4 +148,4 @@ buildvariants:
133148
TOPOLOGY: replica_set
134149
DJANGO_SETTINGS_MODULE: "encrypted_settings"
135150
tasks:
136-
- name: run-tests
151+
- name: run-encryption-tests

.evergreen/run-tests.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@
33
set -eux
44

55
# Export secrets as environment variables
6-
. ../secrets-export.sh
6+
if [[ "${1:-}" == "encryption" ]]; then
7+
. ../secrets-export.sh
8+
fi
79

8-
# Install django-mongodb-backend
10+
# Set up virtual environment
911
/opt/python/3.10/bin/python3 -m venv venv
1012
. venv/bin/activate
1113
python -m pip install -U pip
12-
pip install -e '.[encryption]'
14+
15+
# Conditionally install encryption extra if "encryption" arg is passed
16+
if [[ "${1:-}" == "encryption" ]]; then
17+
pip install -e '.[encryption]'
18+
else
19+
pip install -e .
20+
fi
1321

1422
# Install django and test dependencies
1523
git clone --branch mongodb-5.2.x https://github.com/mongodb-forks/django django_repo

0 commit comments

Comments
 (0)