Skip to content

PHPLIB-1303: Test with serverless proxy #1201

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 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pre:
- func: "install composer"
post:
- func: "upload test results"
- func: "delete serverless instance"
- func: "stop load balancer"
- func: "stop mongo-orchestration"
- func: "cleanup"
Expand Down
60 changes: 9 additions & 51 deletions .evergreen/config/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,73 +176,31 @@ functions:
working_dir: "src"
script: |
${PREPARE_SHELL}
SERVERLESS_DRIVERS_GROUP=${SERVERLESS_DRIVERS_GROUP} \
SERVERLESS_API_PUBLIC_KEY=${SERVERLESS_API_PUBLIC_KEY} \
SERVERLESS_API_PRIVATE_KEY=${SERVERLESS_API_PRIVATE_KEY} \

bash ${DRIVERS_TOOLS}/.evergreen/serverless/setup-secrets.sh
bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh
- command: expansions.update
params:
file: src/serverless-expansion.yml

"create serverless proxy instance":
- command: shell.exec
params:
shell: bash
working_dir: "src"
script: |
${PREPARE_SHELL}

if [ -z "${SERVERLESS_MONGODB_VERSION}" ]; then
echo "expected SERVERLESS_MONGODB_VERSION to be set"
exit 1
fi

. ${DRIVERS_TOOLS}/.evergreen/find-python3.sh
PYTHON_BINARY="$(find_python3)" || exit 1

# Download the enterprise server download for current platform to $MONGODB_BINARIES.
# This is required for tests that need mongocryptd.
# $MONGODB_BINARIES is added to the $PATH in fetch-source.
${PYTHON_BINARY} ${DRIVERS_TOOLS}/.evergreen/mongodl.py \
--component archive \
--version ${SERVERLESS_MONGODB_VERSION} \
--edition enterprise \
--out $MONGODB_BINARIES \
--strip-path-components 2

# Download the crypt_shared dynamic library for the current platform.
${PYTHON_BINARY} ${DRIVERS_TOOLS}/.evergreen/mongodl.py \
--component crypt_shared \
--version ${SERVERLESS_MONGODB_VERSION} \
--edition enterprise \
--out . \
--only "**/mongo_crypt_v1.*" \
--strip-path-components 1

# Find the crypt_shared library file in the current directory and set the CRYPT_SHARED_LIB_PATH to
# the path of that file. Only look for .so, .dll, or .dylib files to prevent matching any other
# downloaded files.
CRYPT_SHARED_LIB_PATH="$(find $(pwd) -maxdepth 1 -type f \
-name 'mongo_crypt_v1.so' -o \
-name 'mongo_crypt_v1.dll' -o \
-name 'mongo_crypt_v1.dylib')"

echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH" >> crypt-expansion.yml

# Load the expansion file to make an evergreen variable with the current unique version
bash ${DRIVERS_TOOLS}/.evergreen/serverless/setup-secrets.sh serverless_next
bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh
- command: expansions.update
params:
file: crypt-expansion.yml
file: src/serverless-expansion.yml

"delete serverless instance":
- command: shell.exec
params:
script: |
# Only run if a serverless instance was started
if [ -n "${SERVERLESS_INSTANCE_NAME}" ]; then
SERVERLESS_INSTANCE_NAME=${SERVERLESS_INSTANCE_NAME} \
SERVERLESS_DRIVERS_GROUP=${SERVERLESS_DRIVERS_GROUP} \
SERVERLESS_API_PUBLIC_KEY=${SERVERLESS_API_PUBLIC_KEY} \
SERVERLESS_API_PRIVATE_KEY=${SERVERLESS_API_PRIVATE_KEY} \
bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh
fi
bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh

"run tests":
- command: shell.exec
Expand Down
38 changes: 38 additions & 0 deletions .evergreen/config/test-task-groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,41 @@ task_groups:
setup_group_timeout_secs: 1800
tasks:
- test-atlas

- name: test_serverless_task_group
setup_group:
- func: "fetch source"
- func: "prepare resources"
- func: "fix absolute paths"
- func: "install dependencies"
- func: "locate PHP binaries"
- func: "fetch extension"
- func: "install composer"
- func: "create serverless instance"
teardown_group:
- func: "delete serverless instance"
- func: "upload test results"
- func: "cleanup"
setup_group_can_fail_task: true
setup_group_timeout_secs: 1800
tasks:
- test-serverless

- name: test_serverless_proxy_task_group
setup_group:
- func: "fetch source"
- func: "prepare resources"
- func: "fix absolute paths"
- func: "install dependencies"
- func: "locate PHP binaries"
- func: "fetch extension"
- func: "install composer"
- func: "create serverless proxy instance"
teardown_group:
- func: "delete serverless instance"
- func: "upload test results"
- func: "cleanup"
setup_group_can_fail_task: true
setup_group_timeout_secs: 1800
tasks:
- test-serverless-proxy
11 changes: 9 additions & 2 deletions .evergreen/config/test-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ tasks:

- name: "test-serverless"
tags: ["serverless"]
exec_timeout_secs: 1800
exec_timeout_secs: 10800
commands:
- func: "start kms servers"
- func: "set aws temp creds"
- func: "run serverless tests"

- name: "test-serverless-proxy"
tags: ["serverless"]
exec_timeout_secs: 10800
commands:
- func: "create serverless instance"
- func: "start kms servers"
- func: "set aws temp creds"
- func: "run serverless tests"
Expand Down
3 changes: 2 additions & 1 deletion .evergreen/config/test-variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ buildvariants:
- ".replicaset .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
- ".sharded .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
- ".loadbalanced .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
- ".serverless"
- "test_serverless_task_group"
- "test_serverless_proxy_task_group"
- name: test-debian92-php82-local
tags: ["test", "debian", "x64"]
display_name: "Test: Debian 9.2, PHP 8.2"
Expand Down