Skip to content

Commit b18931b

Browse files
authored
GODRIVER-2547 Run legacy Client Side Encryption tests on serverless (#1069)
* sync fle2 tests to add load-balanced topology * add Client Side Encryption tests to evg-test-serverless * add MAKEFILE_TARGET to run-tests.sh * use run-tests.sh in run-serverless-tests * download mongo_crypt shared library and mongocryptd in serverless pre tasks
1 parent aa0a380 commit b18931b

33 files changed

+110
-36
lines changed

.evergreen/config.yml

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,18 +564,18 @@ functions:
564564
type: test
565565
params:
566566
working_dir: src/go.mongodb.org/mongo-driver
567+
add_expansions_to_env: true
567568
script: |
568569
${PREPARE_SHELL}
569570
570-
export GOFLAGS=-mod=vendor
571571
AUTH="auth" \
572572
SSL="ssl" \
573573
MONGODB_URI="${SERVERLESS_URI}" \
574574
SERVERLESS="serverless" \
575575
SERVERLESS_ATLAS_USER="${SERVERLESS_ATLAS_USER}" \
576576
SERVERLESS_ATLAS_PASSWORD="${SERVERLESS_ATLAS_PASSWORD}" \
577-
MONGO_GO_DRIVER_COMPRESSOR=${MONGO_GO_DRIVER_COMPRESSOR} \
578-
make evg-test-serverless
577+
MAKEFILE_TARGET=evg-test-serverless \
578+
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
579579
580580
run-atlas-data-lake-test:
581581
- command: shell.exec
@@ -2115,6 +2115,7 @@ task_groups:
21152115
- func: prepare-resources
21162116
- func: fix-absolute-paths
21172117
- func: make-files-executable
2118+
- func: start-cse-servers
21182119
- command: shell.exec
21192120
params:
21202121
shell: "bash"
@@ -2129,6 +2130,56 @@ task_groups:
21292130
- command: expansions.update
21302131
params:
21312132
file: serverless-expansion.yml
2133+
- command: shell.exec
2134+
params:
2135+
shell: "bash"
2136+
script: |
2137+
${PREPARE_SHELL}
2138+
2139+
if [ -z "${SERVERLESS_MONGODB_VERSION}" ]; then
2140+
echo "expected SERVERLESS_MONGODB_VERSION to be set"
2141+
exit 1
2142+
fi
2143+
2144+
# Download the enterprise server download for current platform to $MONGODB_BINARIES.
2145+
# This is required for tests that need mongocryptd.
2146+
# $MONGODB_BINARIES is added to the $PATH in fetch-source.
2147+
${PYTHON3_BINARY} $DRIVERS_TOOLS/.evergreen/mongodl.py \
2148+
--component archive \
2149+
--version ${SERVERLESS_MONGODB_VERSION} \
2150+
--edition enterprise \
2151+
--out $MONGODB_BINARIES \
2152+
--strip-path-components 2
2153+
2154+
# Download the crypt_shared dynamic library for the current platform.
2155+
${PYTHON3_BINARY} $DRIVERS_TOOLS/.evergreen/mongodl.py \
2156+
--component crypt_shared \
2157+
--version ${SERVERLESS_MONGODB_VERSION} \
2158+
--edition enterprise \
2159+
--out . \
2160+
--only "**/mongo_crypt_v1.*" \
2161+
--strip-path-components 1
2162+
2163+
# Find the crypt_shared library file in the current directory and set the CRYPT_SHARED_LIB_PATH to
2164+
# the path of that file. Only look for .so, .dll, or .dylib files to prevent matching any other
2165+
# downloaded files.
2166+
CRYPT_SHARED_LIB_PATH="$(find $(pwd) -maxdepth 1 -type f \
2167+
-name 'mongo_crypt_v1.so' -o \
2168+
-name 'mongo_crypt_v1.dll' -o \
2169+
-name 'mongo_crypt_v1.dylib')"
2170+
2171+
# If we're on Windows, convert the "cygdrive" path to Windows-style paths.
2172+
if [ "Windows_NT" = "$OS" ]; then
2173+
CRYPT_SHARED_LIB_PATH=$(cygpath -m $CRYPT_SHARED_LIB_PATH)
2174+
fi
2175+
2176+
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH" >> crypt-expansion.yml
2177+
2178+
# Load the expansion file to make an evergreen variable with the current unique version
2179+
- command: expansions.update
2180+
params:
2181+
file: crypt-expansion.yml
2182+
21322183
teardown_group:
21332184
- command: shell.exec
21342185
params:

.evergreen/run-tests.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export LD_LIBRARY_PATH=$(pwd)/install/libmongocrypt/lib
2020
export GOFLAGS=-mod=vendor
2121

2222
SSL=${SSL:-nossl}
23-
if [ "$SSL" != "nossl" ]; then
23+
if [ "$SSL" != "nossl" -a -z "${SERVERLESS+x}" ]; then
2424
export MONGO_GO_DRIVER_CA_FILE="${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem"
2525
export MONGO_GO_DRIVER_KEY_FILE="${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem"
2626
export MONGO_GO_DRIVER_PKCS8_ENCRYPTED_KEY_FILE="${DRIVERS_TOOLS}/.evergreen/x509gen/client-pkcs8-encrypted.pem"
@@ -104,6 +104,10 @@ if [ "Windows_NT" = "$OS" ]; then
104104
CSFLE_TLS_CERTIFICATE_KEY_FILE=$(cygpath -m $CSFLE_TLS_CERTIFICATE_KEY_FILE)
105105
fi
106106

107+
if [ -z ${MAKEFILE_TARGET+x} ]; then
108+
MAKEFILE_TARGET="evg-test"
109+
fi
110+
107111
AUTH=${AUTH} \
108112
SSL=${SSL} \
109113
MONGO_GO_DRIVER_CA_FILE=${MONGO_GO_DRIVER_CA_FILE} \
@@ -128,6 +132,6 @@ GCP_PRIVATE_KEY="${cse_gcp_private_key}" \
128132
CSFLE_TLS_CA_FILE="$CSFLE_TLS_CA_FILE" \
129133
CSFLE_TLS_CERTIFICATE_KEY_FILE="$CSFLE_TLS_CERTIFICATE_KEY_FILE" \
130134
CRYPT_SHARED_LIB_PATH=$CRYPT_SHARED_LIB_PATH \
131-
make evg-test \
135+
make $MAKEFILE_TARGET \
132136
PKG_CONFIG_PATH=$PKG_CONFIG_PATH \
133137
LD_LIBRARY_PATH=$LD_LIBRARY_PATH

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ evg-test-serverless:
180180
go test $(BUILD_TAGS) ./mongo/integration -run TestConvenientTransactions -v -timeout $(TEST_TIMEOUT)s >> test.suite
181181
go test $(BUILD_TAGS) ./mongo/integration -run TestCursor -v -timeout $(TEST_TIMEOUT)s >> test.suite
182182
go test $(BUILD_TAGS) ./mongo/integration/unified -run TestUnifiedSpec -v -timeout $(TEST_TIMEOUT)s >> test.suite
183+
go test -exec "env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)" $(BUILD_TAGS) -v -timeout $(TEST_TIMEOUT)s ./mongo/integration -run TestClientSideEncryptionSpec >> test.suite
184+
go test -exec "env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)" $(BUILD_TAGS) -v -timeout $(TEST_TIMEOUT)s ./mongo/integration -run TestClientSideEncryptionProse >> test.suite
183185

184186
.PHONY: evg-test-versioned-api
185187
evg-test-versioned-api:

testdata/client-side-encryption/legacy/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
],

testdata/client-side-encryption/legacy/fle2-BypassQueryAnalysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
runOn:
22
- minServerVersion: "6.0.0"
33
# FLE 2 Encrypted collections are not supported on standalone.
4-
topology: [ "replicaset", "sharded" ]
4+
topology: [ "replicaset", "sharded", "load-balanced" ]
55
database_name: &database_name "default"
66
collection_name: &collection_name "default"
77
data: []

testdata/client-side-encryption/legacy/fle2-Compact.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"runOn": [
33
{
44
"minServerVersion": "6.0.0",
5-
"topologies": [
5+
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

testdata/client-side-encryption/legacy/fle2-Compact.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
runOn:
22
- minServerVersion: "6.0.0"
3-
topologies: [ "replicaset", "sharded" ]
3+
# FLE 2 Encrypted collections are not supported on standalone.
4+
topology: [ "replicaset", "sharded", "load-balanced" ]
45
database_name: &database_name "default"
56
collection_name: &collection_name "default"
67
data: []

testdata/client-side-encryption/legacy/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
],

testdata/client-side-encryption/legacy/fle2-CreateCollection.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
runOn:
33
- minServerVersion: "6.0.0"
44
# FLE 2 Encrypted collections are not supported on standalone.
5-
topology: [ "replicaset", "sharded" ]
5+
topology: [ "replicaset", "sharded", "load-balanced" ]
66

77
database_name: &database_name "default"
88
collection_name: &collection_name "default"

testdata/client-side-encryption/legacy/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
],

0 commit comments

Comments
 (0)