@@ -328,13 +328,75 @@ functions:
328328 sh ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh
329329
330330 " run tox " :
331+ # If testing FLE, start the KMS mock servers, first create the virtualenv.
332+ - command : shell.exec
333+ params :
334+ script : |
335+ ${PREPARE_SHELL}
336+ cd ${DRIVERS_TOOLS}/.evergreen/csfle
337+ . ./activate_venv.sh
338+ # Run in the background so the mock servers don't block the EVG task.
339+ - command : shell.exec
340+ params :
341+ background : true
342+ script : |
343+ ${PREPARE_SHELL}
344+ cd ${DRIVERS_TOOLS}/.evergreen/csfle
345+ . ./activate_venv.sh
346+ # The -u options forces the stdout and stderr streams to be unbuffered.
347+ # TMPDIR is required to avoid "AF_UNIX path too long" errors.
348+ TMPDIR="$(dirname $DRIVERS_TOOLS)" python -u kms_kmip_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 5698 &
349+ python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
350+ python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
351+ python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert &
352+ # Wait up to 10 seconds for the KMIP server to start.
353+ - command : shell.exec
354+ params :
355+ script : |
356+ ${PREPARE_SHELL}
357+ cd ${DRIVERS_TOOLS}/.evergreen/csfle
358+ . ./activate_venv.sh
359+ for i in $(seq 1 1 10); do
360+ sleep 1
361+ if python -u kms_kmip_client.py; then
362+ echo 'KMS KMIP server started!'
363+ exit 0
364+ fi
365+ done
366+ echo 'Failed to start KMIP server!'
367+ exit 1
368+ - command : shell.exec
369+ type : test
370+ params :
371+ silent : true
372+ working_dir : " src"
373+ script : |
374+ cat <<EOT > fle_creds.sh
375+ export FLE_AWS_KEY="${fle_aws_key}"
376+ export FLE_AWS_SECRET="${fle_aws_secret}"
377+ export FLE_AZURE_CLIENTID="${fle_azure_clientid}"
378+ export FLE_AZURE_TENANTID="${fle_azure_tenantid}"
379+ export FLE_AZURE_CLIENTSECRET="${fle_azure_clientsecret}"
380+ export FLE_GCP_EMAIL="${fle_gcp_email}"
381+ export FLE_GCP_PRIVATEKEY="${fle_gcp_privatekey}"
382+ # Needed for generating temporary aws credentials.
383+ export AWS_ACCESS_KEY_ID="${fle_aws_key}"
384+ export AWS_SECRET_ACCESS_KEY="${fle_aws_secret}"
385+ export AWS_DEFAULT_REGION=us-east-1
386+ EOT
331387 - command : shell.exec
332388 type : test
333389 params :
334390 working_dir : " src"
335391 script : |
336392 ${PREPARE_SHELL}
337-
393+ # Disable xtrace (just in case it was accidentally set).
394+ set +x
395+ . ./fle_creds.sh
396+ rm -f ./fle_creds.sh
397+ set -x
398+ export LIBMONGOCRYPT_URL="${libmongocrypt_url}"
399+ export TEST_ENCRYPTION=1
338400 PYTHON_BINARY="${PYTHON_BINARY}" \
339401 TOX_BINARY="${TOX_BINARY}" \
340402 TOX_ENV="${TOX_ENV}" \
0 commit comments