Skip to content

Commit af09be1

Browse files
authored
Merge branch 'master' into PYTHON-4851
2 parents f9e75a0 + 0e8d704 commit af09be1

File tree

231 files changed

+14592
-5039
lines changed

Some content is hidden

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

231 files changed

+14592
-5039
lines changed

.evergreen/config.yml

Lines changed: 427 additions & 1811 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ else # Set up virtualenv before installing hatch
2929
# Ensure hatch does not write to user or global locations.
3030
touch hatch_config.toml
3131
HATCH_CONFIG=$(pwd)/hatch_config.toml
32-
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
32+
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
3333
HATCH_CONFIG=$(cygpath -m "$HATCH_CONFIG")
3434
fi
3535
export HATCH_CONFIG
3636
hatch config restore
37-
hatch config set dirs.data ".hatch/data"
38-
hatch config set dirs.cache ".hatch/cache"
37+
hatch config set dirs.data "$(pwd)/.hatch/data"
38+
hatch config set dirs.cache "$(pwd)/.hatch/cache"
3939

4040
run_hatch() {
4141
python -m hatch run "$@"
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: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ 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
3737
export PIP_PREFER_BINARY=1 # Prefer binary dists by default
3838

3939
set +x
4040
python -c "import sys; sys.exit(sys.prefix == sys.base_prefix)" || (echo "Not inside a virtual env!"; exit 1)
41+
PYTHON_IMPL=$(python -c "import platform; print(platform.python_implementation())")
4142

4243
# Try to source local Drivers Secrets
4344
if [ -f ./secrets-export.sh ]; then
@@ -47,19 +48,24 @@ else
4748
echo "Not sourcing secrets"
4849
fi
4950

51+
# Ensure C extensions have compiled.
52+
if [ -z "${NO_EXT:-}" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
53+
python tools/fail_if_no_c.py
54+
fi
55+
5056
if [ "$AUTH" != "noauth" ]; then
51-
if [ ! -z "$TEST_DATA_LAKE" ]; then
57+
if [ -n "$TEST_DATA_LAKE" ]; then
5258
export DB_USER="mhuser"
5359
export DB_PASSWORD="pencil"
54-
elif [ ! -z "$TEST_SERVERLESS" ]; then
55-
source ${DRIVERS_TOOLS}/.evergreen/serverless/secrets-export.sh
60+
elif [ -n "$TEST_SERVERLESS" ]; then
61+
source "${DRIVERS_TOOLS}"/.evergreen/serverless/secrets-export.sh
5662
export DB_USER=$SERVERLESS_ATLAS_USER
5763
export DB_PASSWORD=$SERVERLESS_ATLAS_PASSWORD
5864
export MONGODB_URI="$SERVERLESS_URI"
5965
echo "MONGODB_URI=$MONGODB_URI"
6066
export SINGLE_MONGOS_LB_URI=$MONGODB_URI
6167
export MULTI_MONGOS_LB_URI=$MONGODB_URI
62-
elif [ ! -z "$TEST_AUTH_OIDC" ]; then
68+
elif [ -n "$TEST_AUTH_OIDC" ]; then
6369
export DB_USER=$OIDC_ADMIN_USER
6470
export DB_PASSWORD=$OIDC_ADMIN_PWD
6571
export DB_IP="$MONGODB_URI"
@@ -90,6 +96,8 @@ if [ -n "$TEST_ENTERPRISE_AUTH" ]; then
9096
export GSSAPI_HOST=${SASL_HOST}
9197
export GSSAPI_PORT=${SASL_PORT}
9298
export GSSAPI_PRINCIPAL=${PRINCIPAL}
99+
100+
export TEST_SUITES="auth"
93101
fi
94102

95103
if [ -n "$TEST_LOADBALANCER" ]; then
@@ -238,7 +246,6 @@ python -c 'import sys; print(sys.version)'
238246

239247
# Run the tests with coverage if requested and coverage is installed.
240248
# Only cover CPython. PyPy reports suspiciously low coverage.
241-
PYTHON_IMPL=$(python -c "import platform; print(platform.python_implementation())")
242249
if [ -n "$COVERAGE" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
243250
# Keep in sync with combine-coverage.sh.
244251
# coverage >=5 is needed for relative_files=true.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -o xtrace
4+
mkdir out_dir
5+
# shellcheck disable=SC2156
6+
find "$MONGO_ORCHESTRATION_HOME" -name \*.log -exec sh -c 'x="{}"; mv $x $PWD/out_dir/$(basename $(dirname $x))_$(basename $x)' \;
7+
tar zcvf mongodb-logs.tar.gz -C out_dir/ .
8+
rm -rf out_dir
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
set -o xtrace
4+
5+
# Enable core dumps if enabled on the machine
6+
# Copied from https://github.com/mongodb/mongo/blob/master/etc/evergreen.yml
7+
if [ -f /proc/self/coredump_filter ]; then
8+
# Set the shell process (and its children processes) to dump ELF headers (bit 4),
9+
# anonymous shared mappings (bit 1), and anonymous private mappings (bit 0).
10+
echo 0x13 >/proc/self/coredump_filter
11+
12+
if [ -f /sbin/sysctl ]; then
13+
# Check that the core pattern is set explicitly on our distro image instead
14+
# of being the OS's default value. This ensures that coredump names are consistent
15+
# across distros and can be picked up by Evergreen.
16+
core_pattern=$(/sbin/sysctl -n "kernel.core_pattern")
17+
if [ "$core_pattern" = "dump_%e.%p.core" ]; then
18+
echo "Enabling coredumps"
19+
ulimit -c unlimited
20+
fi
21+
fi
22+
fi
23+
24+
if [ "$(uname -s)" = "Darwin" ]; then
25+
core_pattern_mac=$(/usr/sbin/sysctl -n "kern.corefile")
26+
if [ "$core_pattern_mac" = "dump_%N.%P.core" ]; then
27+
echo "Enabling coredumps"
28+
ulimit -c unlimited
29+
fi
30+
fi
31+
32+
if [ -n "${skip_crypt_shared}" ]; then
33+
export SKIP_CRYPT_SHARED=1
34+
fi
35+
36+
MONGODB_VERSION=${VERSION} \
37+
TOPOLOGY=${TOPOLOGY} \
38+
AUTH=${AUTH:-noauth} \
39+
SSL=${SSL:-nossl} \
40+
STORAGE_ENGINE=${STORAGE_ENGINE:-} \
41+
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS:-} \
42+
ORCHESTRATION_FILE=${ORCHESTRATION_FILE:-} \
43+
REQUIRE_API_VERSION=${REQUIRE_API_VERSION:-} \
44+
LOAD_BALANCER=${LOAD_BALANCER:-} \
45+
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
46+
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
. .evergreen/scripts/env.sh
4+
set -x
5+
export BASE_SHA="$1"
6+
export HEAD_SHA="$2"
7+
bash .evergreen/run-import-time-test.sh

0 commit comments

Comments
 (0)