Skip to content

Commit c697472

Browse files
authored
PHPLIB-950: Run legacy CSFLE tests on serverless (#988)
* Download mongocryptd and crypt_shared for serverless tests * Export FLE secrets to enable testing * Run KMS servers when testing against serverless * PHPLIB-950: Run legacy CSFLE tests on serverless This syncs legacy CSFLE tests with mongodb/specifications@59a07b7
1 parent 1cc953a commit c697472

17 files changed

+94
-15
lines changed

.evergreen/config.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,55 @@ functions:
212212
- command: expansions.update
213213
params:
214214
file: src/serverless-expansion.yml
215+
- command: shell.exec
216+
params:
217+
shell: "bash"
218+
script: |
219+
${PREPARE_SHELL}
220+
221+
if [ -z "${SERVERLESS_MONGODB_VERSION}" ]; then
222+
echo "expected SERVERLESS_MONGODB_VERSION to be set"
223+
exit 1
224+
fi
225+
226+
# Download the enterprise server download for current platform to $MONGODB_BINARIES.
227+
# This is required for tests that need mongocryptd.
228+
# $MONGODB_BINARIES is added to the $PATH in fetch-source.
229+
${PYTHON3_BINARY} $DRIVERS_TOOLS/.evergreen/mongodl.py \
230+
--component archive \
231+
--version ${SERVERLESS_MONGODB_VERSION} \
232+
--edition enterprise \
233+
--out $MONGODB_BINARIES \
234+
--strip-path-components 2
235+
236+
# Download the crypt_shared dynamic library for the current platform.
237+
${PYTHON3_BINARY} $DRIVERS_TOOLS/.evergreen/mongodl.py \
238+
--component crypt_shared \
239+
--version ${SERVERLESS_MONGODB_VERSION} \
240+
--edition enterprise \
241+
--out . \
242+
--only "**/mongo_crypt_v1.*" \
243+
--strip-path-components 1
244+
245+
# Find the crypt_shared library file in the current directory and set the CRYPT_SHARED_LIB_PATH to
246+
# the path of that file. Only look for .so, .dll, or .dylib files to prevent matching any other
247+
# downloaded files.
248+
CRYPT_SHARED_LIB_PATH="$(find $(pwd) -maxdepth 1 -type f \
249+
-name 'mongo_crypt_v1.so' -o \
250+
-name 'mongo_crypt_v1.dll' -o \
251+
-name 'mongo_crypt_v1.dylib')"
252+
253+
# If we're on Windows, convert the "cygdrive" path to Windows-style paths.
254+
if [ "Windows_NT" = "$OS" ]; then
255+
CRYPT_SHARED_LIB_PATH=$(cygpath -m $CRYPT_SHARED_LIB_PATH)
256+
fi
257+
258+
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH" >> crypt-expansion.yml
259+
260+
# Load the expansion file to make an evergreen variable with the current unique version
261+
- command: expansions.update
262+
params:
263+
file: crypt-expansion.yml
215264

216265
"delete serverless instance":
217266
- command: shell.exec
@@ -277,6 +326,19 @@ functions:
277326
working_dir: "src"
278327
script: |
279328
${PREPARE_SHELL}
329+
export AWS_ACCESS_KEY_ID="${client_side_encryption_aws_access_key_id}"
330+
export AWS_SECRET_ACCESS_KEY="${client_side_encryption_aws_secret_access_key}"
331+
export AZURE_TENANT_ID="${client_side_encryption_azure_tenant_id}"
332+
export AZURE_CLIENT_ID="${client_side_encryption_azure_client_id}"
333+
export AZURE_CLIENT_SECRET="${client_side_encryption_azure_client_secret}"
334+
export GCP_EMAIL="${client_side_encryption_gcp_email}"
335+
export GCP_PRIVATE_KEY="${client_side_encryption_gcp_privatekey}"
336+
export KMIP_ENDPOINT="${client_side_encryption_kmip_endpoint}"
337+
export KMS_ENDPOINT_EXPIRED="${client_side_encryption_kms_endpoint_expired}"
338+
export KMS_ENDPOINT_WRONG_HOST="${client_side_encryption_kms_endpoint_wrong_host}"
339+
export KMS_ENDPOINT_REQUIRE_CLIENT_CERT="${client_side_encryption_kms_endpoint_require_client_cert}"
340+
export KMS_TLS_CA_FILE="${client_side_encryption_kms_tls_ca_file}"
341+
export KMS_TLS_CERTIFICATE_KEY_FILE="${client_side_encryption_kms_tls_certificate_key_file}"
280342
export MONGODB_IS_SERVERLESS=on
281343
export MONGODB_USERNAME=${SERVERLESS_ATLAS_USER}
282344
export MONGODB_PASSWORD=${SERVERLESS_ATLAS_PASSWORD}
@@ -505,6 +567,7 @@ tasks:
505567
tags: ["serverless"]
506568
commands:
507569
- func: "create serverless instance"
570+
- func: "start kms servers"
508571
- func: "run serverless tests"
509572

510573
- name: "test-loadBalanced"

tests/SpecTests/ClientSideEncryptionSpecTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
*
5656
* @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption
5757
* @group csfle
58+
* @group serverless
5859
*/
5960
class ClientSideEncryptionSpecTest extends FunctionalTestCase
6061
{

tests/SpecTests/client-side-encryption/tests/fle2-BypassQueryAnalysis.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-Compact.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-CreateCollection.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-DecryptExistingData.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-Delete.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-EncryptedFields-vs-EncryptedFieldsMap.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-EncryptedFields-vs-jsonSchema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-EncryptedFieldsMap-defaults.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-FindOneAndUpdate.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-InsertFind-Indexed.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-InsertFind-Unindexed.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-MissingKey.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-NoEncryption.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-Update.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

tests/SpecTests/client-side-encryption/tests/fle2-validatorAndPartialFieldExpression.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "6.0.0",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

0 commit comments

Comments
 (0)