Skip to content

Commit 02b6d3a

Browse files
authored
PHPLIB-1303: Test with serverless proxy (#1201)
* PHPLIB-1303: Test with Serverless Proxy * Increase exec_timeout for serverless tasks * Remove obsolete serverless setup steps * Increase serverless task timeout * Use setup-secrets and task groups for serverless tests
1 parent 8b6a7c8 commit 02b6d3a

File tree

5 files changed

+58
-55
lines changed

5 files changed

+58
-55
lines changed

.evergreen/config.yml

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pre:
2525
- func: "install composer"
2626
post:
2727
- func: "upload test results"
28-
- func: "delete serverless instance"
2928
- func: "stop load balancer"
3029
- func: "stop mongo-orchestration"
3130
- func: "cleanup"

.evergreen/config/functions.yml

+9-51
Original file line numberDiff line numberDiff line change
@@ -176,73 +176,31 @@ functions:
176176
working_dir: "src"
177177
script: |
178178
${PREPARE_SHELL}
179-
SERVERLESS_DRIVERS_GROUP=${SERVERLESS_DRIVERS_GROUP} \
180-
SERVERLESS_API_PUBLIC_KEY=${SERVERLESS_API_PUBLIC_KEY} \
181-
SERVERLESS_API_PRIVATE_KEY=${SERVERLESS_API_PRIVATE_KEY} \
179+
180+
bash ${DRIVERS_TOOLS}/.evergreen/serverless/setup-secrets.sh
182181
bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh
183182
- command: expansions.update
184183
params:
185184
file: src/serverless-expansion.yml
185+
186+
"create serverless proxy instance":
186187
- command: shell.exec
187188
params:
188-
shell: bash
189+
working_dir: "src"
189190
script: |
190191
${PREPARE_SHELL}
191192
192-
if [ -z "${SERVERLESS_MONGODB_VERSION}" ]; then
193-
echo "expected SERVERLESS_MONGODB_VERSION to be set"
194-
exit 1
195-
fi
196-
197-
. ${DRIVERS_TOOLS}/.evergreen/find-python3.sh
198-
PYTHON_BINARY="$(find_python3)" || exit 1
199-
200-
# Download the enterprise server download for current platform to $MONGODB_BINARIES.
201-
# This is required for tests that need mongocryptd.
202-
# $MONGODB_BINARIES is added to the $PATH in fetch-source.
203-
${PYTHON_BINARY} ${DRIVERS_TOOLS}/.evergreen/mongodl.py \
204-
--component archive \
205-
--version ${SERVERLESS_MONGODB_VERSION} \
206-
--edition enterprise \
207-
--out $MONGODB_BINARIES \
208-
--strip-path-components 2
209-
210-
# Download the crypt_shared dynamic library for the current platform.
211-
${PYTHON_BINARY} ${DRIVERS_TOOLS}/.evergreen/mongodl.py \
212-
--component crypt_shared \
213-
--version ${SERVERLESS_MONGODB_VERSION} \
214-
--edition enterprise \
215-
--out . \
216-
--only "**/mongo_crypt_v1.*" \
217-
--strip-path-components 1
218-
219-
# Find the crypt_shared library file in the current directory and set the CRYPT_SHARED_LIB_PATH to
220-
# the path of that file. Only look for .so, .dll, or .dylib files to prevent matching any other
221-
# downloaded files.
222-
CRYPT_SHARED_LIB_PATH="$(find $(pwd) -maxdepth 1 -type f \
223-
-name 'mongo_crypt_v1.so' -o \
224-
-name 'mongo_crypt_v1.dll' -o \
225-
-name 'mongo_crypt_v1.dylib')"
226-
227-
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH" >> crypt-expansion.yml
228-
229-
# Load the expansion file to make an evergreen variable with the current unique version
193+
bash ${DRIVERS_TOOLS}/.evergreen/serverless/setup-secrets.sh serverless_next
194+
bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh
230195
- command: expansions.update
231196
params:
232-
file: crypt-expansion.yml
197+
file: src/serverless-expansion.yml
233198

234199
"delete serverless instance":
235200
- command: shell.exec
236201
params:
237202
script: |
238-
# Only run if a serverless instance was started
239-
if [ -n "${SERVERLESS_INSTANCE_NAME}" ]; then
240-
SERVERLESS_INSTANCE_NAME=${SERVERLESS_INSTANCE_NAME} \
241-
SERVERLESS_DRIVERS_GROUP=${SERVERLESS_DRIVERS_GROUP} \
242-
SERVERLESS_API_PUBLIC_KEY=${SERVERLESS_API_PUBLIC_KEY} \
243-
SERVERLESS_API_PRIVATE_KEY=${SERVERLESS_API_PRIVATE_KEY} \
244-
bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh
245-
fi
203+
bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh
246204
247205
"run tests":
248206
- command: shell.exec

.evergreen/config/test-task-groups.yml

+38
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,41 @@ task_groups:
3434
setup_group_timeout_secs: 1800
3535
tasks:
3636
- test-atlas
37+
38+
- name: test_serverless_task_group
39+
setup_group:
40+
- func: "fetch source"
41+
- func: "prepare resources"
42+
- func: "fix absolute paths"
43+
- func: "install dependencies"
44+
- func: "locate PHP binaries"
45+
- func: "fetch extension"
46+
- func: "install composer"
47+
- func: "create serverless instance"
48+
teardown_group:
49+
- func: "delete serverless instance"
50+
- func: "upload test results"
51+
- func: "cleanup"
52+
setup_group_can_fail_task: true
53+
setup_group_timeout_secs: 1800
54+
tasks:
55+
- test-serverless
56+
57+
- name: test_serverless_proxy_task_group
58+
setup_group:
59+
- func: "fetch source"
60+
- func: "prepare resources"
61+
- func: "fix absolute paths"
62+
- func: "install dependencies"
63+
- func: "locate PHP binaries"
64+
- func: "fetch extension"
65+
- func: "install composer"
66+
- func: "create serverless proxy instance"
67+
teardown_group:
68+
- func: "delete serverless instance"
69+
- func: "upload test results"
70+
- func: "cleanup"
71+
setup_group_can_fail_task: true
72+
setup_group_timeout_secs: 1800
73+
tasks:
74+
- test-serverless-proxy

.evergreen/config/test-tasks.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ tasks:
99

1010
- name: "test-serverless"
1111
tags: ["serverless"]
12-
exec_timeout_secs: 1800
12+
exec_timeout_secs: 10800
13+
commands:
14+
- func: "start kms servers"
15+
- func: "set aws temp creds"
16+
- func: "run serverless tests"
17+
18+
- name: "test-serverless-proxy"
19+
tags: ["serverless"]
20+
exec_timeout_secs: 10800
1321
commands:
14-
- func: "create serverless instance"
1522
- func: "start kms servers"
1623
- func: "set aws temp creds"
1724
- func: "run serverless tests"

.evergreen/config/test-variants.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ buildvariants:
2020
- ".replicaset .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
2121
- ".sharded .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
2222
- ".loadbalanced .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
23-
- ".serverless"
23+
- "test_serverless_task_group"
24+
- "test_serverless_proxy_task_group"
2425
- name: test-debian92-php82-local
2526
tags: ["test", "debian", "x64"]
2627
display_name: "Test: Debian 9.2, PHP 8.2"

0 commit comments

Comments
 (0)