-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-683 Test against Proxy as a Mongos #854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3d60340
Split transactions tests for more targeted execution
alcaeus ef17d5e
PHPLIB-684 Add test group annotations for serverless spec tests
alcaeus 01c8775
PHPLIB-685 Sync tests for serverless testing
alcaeus ee8456b
PHPLIB-688 Report serverless mode in unified test runner
alcaeus e41d6e7
Support passing authentication options to test framework
alcaeus b8c0a16
Don't run killAllSessions on serverless
alcaeus 9382478
PHPLIB-688 Check serverless requirement in legacy spec test runner
alcaeus 98ff265
PHPLIB-702 Skip crud-v1 tests that use disabled serverless features
alcaeus 32e63ab
PHPLIB-686 Run serverless tests on evergreen
alcaeus 0d5aa6b
Package serverless for better local debugging
alcaeus 633c8f1
Add note about environment variables overriding URI credentials
alcaeus a8cda4a
PHPLIB-715 Skip failing mapReduce test
alcaeus c843227
Fix wrong driver identifier for serverless tests
alcaeus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.