-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPLIB-683 Test against Proxy as a Mongos (#854)
* Split transactions tests for more targeted execution The tests for transactions are the same for the classic and convenient APIs. Since the serverless spec excludes the convenient API from testing, we need to split this so we can only target the classic API for testing. * PHPLIB-684 Add test group annotations for serverless spec tests * PHPLIB-685 Sync tests for serverless testing * PHPLIB-688 Report serverless mode in unified test runner * Support passing authentication options to test framework * Don't run killAllSessions on serverless * PHPLIB-688 Check serverless requirement in legacy spec test runner * PHPLIB-702 Skip crud-v1 tests that use disabled serverless features * PHPLIB-686 Run serverless tests on evergreen * Package serverless for better local debugging * Add note about environment variables overriding URI credentials * PHPLIB-715 Skip failing mapReduce test * Fix wrong driver identifier for serverless tests
- Loading branch information
Showing
94 changed files
with
572 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set +o xtrace # disable xtrace to ensure credentials aren't leaked | ||
|
||
if [ -z "$PROJECT" ]; then | ||
echo "Project name must be provided via PROJECT environment variable" | ||
exit 1 | ||
fi | ||
INSTANCE_NAME="$RANDOM-$PROJECT" | ||
|
||
if [ -z "$SERVERLESS_DRIVERS_GROUP" ]; then | ||
echo "Drivers Atlas group must be provided via SERVERLESS_DRIVERS_GROUP environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_API_PRIVATE_KEY" ]; then | ||
echo "Atlas API private key must be provided via SERVERLESS_API_PRIVATE_KEY environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_API_PUBLIC_KEY" ]; then | ||
echo "Atlas API public key must be provided via SERVERLESS_API_PUBLIC_KEY environment variable" | ||
exit 1 | ||
fi | ||
|
||
echo "creating new serverless instance \"${INSTANCE_NAME}\"..." | ||
|
||
DIR=$(dirname $0) | ||
API_BASE_URL="https://account-dev.mongodb.com/api/atlas/v1.0/groups/$SERVERLESS_DRIVERS_GROUP" | ||
|
||
curl \ | ||
-u "$SERVERLESS_API_PUBLIC_KEY:$SERVERLESS_API_PRIVATE_KEY" \ | ||
--silent \ | ||
--show-error \ | ||
-X POST \ | ||
--digest \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
"$API_BASE_URL/serverless?pretty=true" \ | ||
--data " | ||
{ | ||
\"name\" : \"${INSTANCE_NAME}\", | ||
\"providerSettings\" : { | ||
\"providerName\": \"SERVERLESS\", | ||
\"backingProviderName\": \"GCP\", | ||
\"instanceSizeName\" : \"SERVERLESS_V2\", | ||
\"regionName\" : \"CENTRAL_US\" | ||
} | ||
}" | ||
|
||
echo "" | ||
|
||
if [ "Windows_NT" = "$OS" ]; then | ||
PYTHON_BINARY=C:/python/Python38/python.exe | ||
else | ||
PYTHON_BINARY=python | ||
fi | ||
|
||
SECONDS=0 | ||
while [ true ]; do | ||
API_RESPONSE=`SERVERLESS_INSTANCE_NAME=$INSTANCE_NAME bash $DIR/get-instance.sh` | ||
STATE_NAME=`echo $API_RESPONSE | $PYTHON_BINARY -c "import sys, json; print(json.load(sys.stdin)['stateName'])" | tr -d '\r\n'` | ||
|
||
if [ "$STATE_NAME" = "IDLE" ]; then | ||
duration="$SECONDS" | ||
echo "setup done! ($(($duration / 60))m $(($duration % 60))s elapsed)" | ||
echo "SERVERLESS_INSTANCE_NAME=\"$INSTANCE_NAME\"" | ||
SRV_ADDRESS=$(echo $API_RESPONSE | $PYTHON_BINARY -c "import sys, json; print(json.load(sys.stdin)['connectionStrings']['standardSrv'])" | tr -d '\r\n') | ||
echo "MONGODB_SRV_URI=\"$SRV_ADDRESS\"" | ||
STANDARD_ADDRESS=$(echo $API_RESPONSE | $PYTHON_BINARY -c "import sys, json; print(json.load(sys.stdin)['connectionStrings']['standard'].replace('&authSource=admin', ''))" | tr -d '\r\n') | ||
echo "MONGODB_URI=\"$STANDARD_ADDRESS\"" | ||
cat <<EOF > serverless-expansion.yml | ||
MONGODB_URI: "$STANDARD_ADDRESS" | ||
MONGODB_SRV_URI: "$SRV_ADDRESS" | ||
SERVERLESS_INSTANCE_NAME: "$INSTANCE_NAME" | ||
SSL: ssl | ||
AUTH: auth | ||
TOPOLOGY: sharded_cluster | ||
SERVERLESS: serverless | ||
EOF | ||
exit 0 | ||
else | ||
echo "setup still in progress, status=$STATE_NAME, sleeping for 1 minute..." | ||
sleep 60 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set +o xtrace | ||
|
||
if [ -z "$SERVERLESS_INSTANCE_NAME" ]; then | ||
echo "Instance name must be provided via SERVERLESS_INSTANCE_NAME environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_DRIVERS_GROUP" ]; then | ||
echo "Drivers Atlas group must be provided via SERVERLESS_DRIVERS_GROUP environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_API_PRIVATE_KEY" ]; then | ||
echo "Atlas API private key must be provided via SERVERLESS_API_PRIVATE_KEY environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_API_PUBLIC_KEY" ]; then | ||
echo "Atlas API public key must be provided via SERVERLESS_API_PUBLIC_KEY environment variable" | ||
exit 1 | ||
fi | ||
|
||
echo "deleting serverless instance \"${SERVERLESS_INSTANCE_NAME}\"..." | ||
|
||
API_BASE_URL="https://account-dev.mongodb.com/api/atlas/v1.0/groups/$SERVERLESS_DRIVERS_GROUP" | ||
|
||
curl \ | ||
--silent \ | ||
--show-error \ | ||
-u "$SERVERLESS_API_PUBLIC_KEY:$SERVERLESS_API_PRIVATE_KEY" \ | ||
-X DELETE \ | ||
--digest \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
"${API_BASE_URL}/serverless/${SERVERLESS_INSTANCE_NAME}?pretty=true" | ||
|
||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set +o xtrace | ||
|
||
if [ -z "$SERVERLESS_INSTANCE_NAME" ]; then | ||
echo "Instance name must be provided via SERVERLESS_INSTANCE_NAME environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_DRIVERS_GROUP" ]; then | ||
echo "Drivers Atlas group must be provided via SERVERLESS_DRIVERS_GROUP environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_API_PRIVATE_KEY" ]; then | ||
echo "Atlas API private key must be provided via SERVERLESS_API_PRIVATE_KEY environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SERVERLESS_API_PUBLIC_KEY" ]; then | ||
echo "Atlas API public key must be provided via SERVERLESS_API_PUBLIC_KEY environment variable" | ||
exit 1 | ||
fi | ||
|
||
API_BASE_URL="https://account-dev.mongodb.com/api/private/nds/serverless/groups/$SERVERLESS_DRIVERS_GROUP" | ||
|
||
curl \ | ||
--silent \ | ||
--show-error \ | ||
-u "$SERVERLESS_API_PUBLIC_KEY:$SERVERLESS_API_PRIVATE_KEY" \ | ||
-X GET \ | ||
--digest \ | ||
--header "Accept: application/json" \ | ||
"${API_BASE_URL}/instances/${SERVERLESS_INSTANCE_NAME}?pretty=true" \ | ||
|
||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.