Skip to content

Commit 491b2b4

Browse files
authored
Merge branch 'master' into PYTHON-1982
2 parents 50d9130 + 63c3f8a commit 491b2b4

File tree

276 files changed

+22932
-5740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+22932
-5740
lines changed

.evergreen/config.yml

Lines changed: 141 additions & 1345 deletions
Large diffs are not rendered by default.

.evergreen/generated_configs/tasks.yml

Lines changed: 4369 additions & 0 deletions
Large diffs are not rendered by default.

.evergreen/generated_configs/variants.yml

Lines changed: 1378 additions & 0 deletions
Large diffs are not rendered by default.

.evergreen/hatch.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,25 @@ if [ -n "$SKIP_HATCH" ]; then
1818
run_hatch() {
1919
bash ./.evergreen/run-tests.sh
2020
}
21-
elif $PYTHON_BINARY -m hatch --version; then
22-
run_hatch() {
23-
$PYTHON_BINARY -m hatch run "$@"
24-
}
25-
else # No toolchain hatch present, set up virtualenv before installing hatch
21+
else # Set up virtualenv before installing hatch
2622
# Use a random venv name because the encryption tasks run this script multiple times in the same run.
2723
ENV_NAME=hatchenv-$RANDOM
2824
createvirtualenv "$PYTHON_BINARY" $ENV_NAME
2925
# shellcheck disable=SC2064
3026
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP
3127
python -m pip install -q hatch
28+
29+
# Ensure hatch does not write to user or global locations.
30+
touch hatch_config.toml
31+
HATCH_CONFIG=$(pwd)/hatch_config.toml
32+
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
33+
HATCH_CONFIG=$(cygpath -m "$HATCH_CONFIG")
34+
fi
35+
export HATCH_CONFIG
36+
hatch config restore
37+
hatch config set dirs.data "$(pwd)/.hatch/data"
38+
hatch config set dirs.cache "$(pwd)/.hatch/cache"
39+
3240
run_hatch() {
3341
python -m hatch run "$@"
3442
}

.evergreen/resync-specs.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ do
7676
atlas-data-lake-testing|data_lake)
7777
cpjson atlas-data-lake-testing/tests/ data_lake
7878
;;
79+
bson-binary-vector|bson_binary_vector)
80+
cpjson bson-binary-vector/tests/ bson_binary_vector
81+
;;
7982
bson-corpus|bson_corpus)
8083
cpjson bson-corpus/tests/ bson_corpus
8184
;;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
set +x # Disable debug trace
4+
set -eu
5+
6+
echo "Running MONGODB-OIDC remote tests"
7+
8+
OIDC_ENV=${OIDC_ENV:-"test"}
9+
10+
# Make sure DRIVERS_TOOLS is set.
11+
if [ -z "$DRIVERS_TOOLS" ]; then
12+
echo "Must specify DRIVERS_TOOLS"
13+
exit 1
14+
fi
15+
16+
# Set up the remote files to test.
17+
git add .
18+
git commit -m "add files" || true
19+
export TEST_TAR_FILE=/tmp/mongo-python-driver.tgz
20+
git archive -o $TEST_TAR_FILE HEAD
21+
22+
pushd $DRIVERS_TOOLS
23+
24+
if [ $OIDC_ENV == "test" ]; then
25+
echo "Test OIDC environment does not support remote test!"
26+
exit 1
27+
28+
elif [ $OIDC_ENV == "azure" ]; then
29+
export AZUREOIDC_DRIVERS_TAR_FILE=$TEST_TAR_FILE
30+
export AZUREOIDC_TEST_CMD="OIDC_ENV=azure ./.evergreen/run-mongodb-oidc-test.sh"
31+
bash ./.evergreen/auth_oidc/azure/run-driver-test.sh
32+
33+
elif [ $OIDC_ENV == "gcp" ]; then
34+
export GCPOIDC_DRIVERS_TAR_FILE=$TEST_TAR_FILE
35+
export GCPOIDC_TEST_CMD="OIDC_ENV=gcp ./.evergreen/run-mongodb-oidc-test.sh"
36+
bash ./.evergreen/auth_oidc/gcp/run-driver-test.sh
37+
38+
elif [ $OIDC_ENV == "k8s" ]; then
39+
# Make sure K8S_VARIANT is set.
40+
if [ -z "$K8S_VARIANT" ]; then
41+
echo "Must specify K8S_VARIANT"
42+
popd
43+
exit 1
44+
fi
45+
46+
bash ./.evergreen/auth_oidc/k8s/setup-pod.sh
47+
bash ./.evergreen/auth_oidc/k8s/run-self-test.sh
48+
export K8S_DRIVERS_TAR_FILE=$TEST_TAR_FILE
49+
export K8S_TEST_CMD="OIDC_ENV=k8s ./.evergreen/run-mongodb-oidc-test.sh"
50+
source ./.evergreen/auth_oidc/k8s/secrets-export.sh # for MONGODB_URI
51+
bash ./.evergreen/auth_oidc/k8s/run-driver-test.sh
52+
bash ./.evergreen/auth_oidc/k8s/teardown-pod.sh
53+
54+
else
55+
echo "Unrecognized OIDC_ENV $OIDC_ENV"
56+
pod
57+
exit 1
58+
fi
59+
60+
popd

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ elif [ $OIDC_ENV == "azure" ]; then
2121
elif [ $OIDC_ENV == "gcp" ]; then
2222
source ./secrets-export.sh
2323

24+
elif [ $OIDC_ENV == "k8s" ]; then
25+
echo "Running oidc on k8s"
26+
2427
else
2528
echo "Unrecognized OIDC_ENV $OIDC_ENV"
2629
exit 1

.evergreen/run-tests.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ set -o xtrace
3030

3131
AUTH=${AUTH:-noauth}
3232
SSL=${SSL:-nossl}
33-
TEST_SUITES=""
33+
TEST_SUITES=${TEST_SUITES:-}
3434
TEST_ARGS="${*:1}"
3535

3636
export PIP_QUIET=1 # Quiet by default
@@ -90,6 +90,8 @@ if [ -n "$TEST_ENTERPRISE_AUTH" ]; then
9090
export GSSAPI_HOST=${SASL_HOST}
9191
export GSSAPI_PORT=${SASL_PORT}
9292
export GSSAPI_PRINCIPAL=${PRINCIPAL}
93+
94+
export TEST_SUITES="auth"
9395
fi
9496

9597
if [ -n "$TEST_LOADBALANCER" ]; then
@@ -224,6 +226,9 @@ if [ -n "$PERF_TEST" ]; then
224226
python -m pip install simplejson
225227
start_time=$(date +%s)
226228
TEST_SUITES="perf"
229+
# PYTHON-4769 Run perf_test.py directly otherwise pytest's test collection negatively
230+
# affects the benchmark results.
231+
TEST_ARGS="test/performance/perf_test.py $TEST_ARGS"
227232
fi
228233

229234
echo "Running $AUTH tests over $SSL with python $(which python)"
@@ -254,9 +259,9 @@ if [ -z "$GREEN_FRAMEWORK" ]; then
254259
# Use --capture=tee-sys so pytest prints test output inline:
255260
# https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html
256261
if [ -z "$TEST_SUITES" ]; then
257-
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_ARGS
262+
python -m pytest -v --capture=tee-sys --durations=5 $TEST_ARGS
258263
else
259-
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 -m $TEST_SUITES $TEST_ARGS
264+
python -m pytest -v --capture=tee-sys --durations=5 -m $TEST_SUITES $TEST_ARGS
260265
fi
261266
else
262267
python green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS

.evergreen/scripts/configure-env.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export PROJECT="$project"
4646
export PIP_QUIET=1
4747
EOT
4848

49+
# Skip CSOT tests on non-linux platforms.
50+
if [ "$(uname -s)" != "Linux" ]; then
51+
echo "export SKIP_CSOT_TESTS=1" >> $SCRIPT_DIR/env.sh
52+
fi
53+
4954
# Add these expansions to make it easier to call out tests scripts from the EVG yaml
5055
cat <<EOT > expansion.yml
5156
DRIVERS_TOOLS: "$DRIVERS_TOOLS"

0 commit comments

Comments
 (0)