-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PYTHON-4502 Add integration test with pymongo (#836)
- Loading branch information
Showing
7 changed files
with
169 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/bash | ||
|
||
set -eux | ||
|
||
DRIVERS_TOOLS="$(pwd)/drivers-tools" | ||
PROJECT_DIRECTORY="${project_directory}" | ||
PYMONGO_DIR="$(pwd)/mongo-python-driver" | ||
|
||
# Python has cygwin path problems on Windows. | ||
if [ "Windows_NT" = "${OS:-}" ]; then | ||
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) | ||
PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY) | ||
fi | ||
export PROJECT_DIRECTORY | ||
export DRIVERS_TOOLS | ||
|
||
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration" | ||
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" | ||
export MONGOCRYPT_DIR=${PROJECT_DIRECTORY}/all/${variant_name} | ||
|
||
cat <<EOT > expansion.yml | ||
DRIVERS_TOOLS: "$DRIVERS_TOOLS" | ||
MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME" | ||
MONGODB_BINARIES: "$MONGODB_BINARIES" | ||
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY" | ||
PYMONGO_DIR: "$PYMONGO_DIR" | ||
MONGOCRYPT_DIR: "$MONGOCRYPT_DIR" | ||
EOT | ||
|
||
# Set up drivers-tools with a .env file. | ||
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git ${DRIVERS_TOOLS} | ||
cat <<EOT > ${DRIVERS_TOOLS}/.env | ||
DRIVERS_TOOLS="$DRIVERS_TOOLS" | ||
MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME" | ||
MONGODB_BINARIES="$MONGODB_BINARIES" | ||
PROJECT_DIRECTORY="$PROJECT_DIRECTORY" | ||
EOT | ||
|
||
# Get the secrets | ||
bash $DRIVERS_TOOLS/.evergreen/csfle/setup-secrets.sh | ||
|
||
# Clone mongo-python-driver | ||
git clone https://github.com/mongodb/mongo-python-driver.git ${PYMONGO_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#! /bin/bash | ||
set -o xtrace # Write all commands first to stderr | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
|
||
bash ${DRIVERS_TOOLS}/.evergreen/csfle/teardown.sh | ||
bash ${DRIVERS_TOOLS}/.evergreen/teardown.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#! /bin/bash | ||
set -eux | ||
|
||
pushd $(pwd)/libmongocrypt/bindings/python | ||
|
||
# For createvirtualenv and find_python3 | ||
. .evergreen/utils.sh | ||
|
||
BASE_PYTHON=$(find_python3) | ||
|
||
# MONGOCRYPT_DIR is set by libmongocrypt/.evergreen/config.yml | ||
MONGOCRYPT_DIR="$MONGOCRYPT_DIR" | ||
|
||
MACHINE=$(uname -m) | ||
if [ $MACHINE == "aarch64" ]; then | ||
PYTHON="/opt/mongodbtoolchain/v4/bin/python3" | ||
TARGET=rhel82 | ||
else | ||
TARGET=rhel80 | ||
PYTHON="/opt/python/3.8/bin/python3" | ||
fi | ||
|
||
CRYPT_SHARED_DIR="$(pwd)/crypt_shared" | ||
/opt/mongodbtoolchain/v3/bin/python3 $DRIVERS_TOOLS/.evergreen/mongodl.py --component \ | ||
crypt_shared --version latest --out $CRYPT_SHARED_DIR --target $TARGET | ||
|
||
if [ -e "${MONGOCRYPT_DIR}/lib64/" ]; then | ||
export PYMONGOCRYPT_LIB=${MONGOCRYPT_DIR}/nocrypto/lib64/libmongocrypt.so | ||
PYMONGOCRYPT_LIB_CRYPTO=${MONGOCRYPT_DIR}/lib64/libmongocrypt.so | ||
else | ||
export PYMONGOCRYPT_LIB=${MONGOCRYPT_DIR}/nocrypto/lib/libmongocrypt.so | ||
PYMONGOCRYPT_LIB_CRYPTO=${MONGOCRYPT_DIR}/lib/libmongocrypt.so | ||
fi | ||
|
||
createvirtualenv $PYTHON .venv | ||
pip install -e . | ||
pushd $PYMONGO_DIR | ||
pip install -e ".[test,encryption]" | ||
source ${DRIVERS_TOOLS}/.evergreen/csfle/secrets-export.sh | ||
set -x | ||
TEST_CRYPT_SHARED=1 DYLD_FALLBACK_LIBRARY_PATH=$CRYPT_SHARED_DIR/lib/:${DYLD_FALLBACK_LIBRARY_PATH:-} \ | ||
LD_LIBRARY_PATH=$CRYPT_SHARED_DIR/lib:${LD_LIBRARY_PATH-} \ | ||
PATH=$CRYPT_SHARED_DIR/bin:$PATH \ | ||
AUTH=auth SSL=ssl \ | ||
.evergreen/run-tests.sh "test/test_encryption.py" | ||
|
||
popd | ||
deactivate | ||
rm -rf .venv | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,4 +70,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |