-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
189 additions
and
49 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,29 @@ | ||
echo "Starting tests for CDI $1, FDI $2"; | ||
|
||
if [ -z "$SUPERTOKENS_API_KEY" ]; then | ||
echo "SUPERTOKENS_API_KEY not set" | ||
exit 1 | ||
fi | ||
|
||
coreDriverVersion=$1 | ||
coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` | ||
|
||
frontendDriverVersion=$2 | ||
|
||
coreFree=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=golang" \ | ||
-H 'api-version: 1'` | ||
if [[ `echo $coreFree | jq .core` == "null" ]] | ||
then | ||
echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." | ||
exit 1 | ||
fi | ||
coreFree=$(echo $coreFree | jq .core | tr -d '"') | ||
|
||
./setupAndTestBackendSDKWithFreeCore.sh $coreFree $coreDriverVersion $frontendDriverVersion | ||
if [[ $? -ne 0 ]] | ||
then | ||
echo "test failed... exiting!" | ||
exit 1 | ||
fi | ||
rm -rf ../../supertokens-root |
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,77 @@ | ||
coreInfo=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ | ||
-H 'api-version: 0'` | ||
if [[ `echo $coreInfo | jq .tag` == "null" ]] | ||
then | ||
echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" | ||
exit 1 | ||
fi | ||
coreTag=$(echo $coreInfo | jq .tag | tr -d '"') | ||
coreVersion=$(echo $coreInfo | jq .version | tr -d '"') | ||
|
||
pluginInterfaceVersionXY=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ | ||
-H 'api-version: 0'` | ||
if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] | ||
then | ||
echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" | ||
exit 1 | ||
fi | ||
pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') | ||
|
||
pluginInterfaceInfo=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ | ||
-H 'api-version: 0'` | ||
if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] | ||
then | ||
echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" | ||
exit 1 | ||
fi | ||
pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') | ||
pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') | ||
|
||
echo "Backend SDK Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion, fdi-version: $3" | ||
|
||
cd ../../ | ||
git clone [email protected]:supertokens/supertokens-root.git | ||
cd supertokens-root | ||
if [[ $2 == "2.0" ]] || [[ $2 == "2.1" ]] || [[ $2 == "2.2" ]] | ||
then | ||
git checkout 36e5af1b9a4e3b07247d0cf333cf82a071a78681 | ||
fi | ||
echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt | ||
./loadModules --ssh | ||
cd supertokens-core | ||
git checkout $coreTag | ||
cd ../supertokens-plugin-interface | ||
git checkout $pluginInterfaceTag | ||
cd ../ | ||
echo $SUPERTOKENS_API_KEY > apiPassword | ||
./utils/setupTestEnvLocal | ||
cd ../project/ | ||
|
||
API_PORT=3030 | ||
ST_CONNECTION_URI=http://localhost:8081 | ||
|
||
# start test-server | ||
pushd test/test-server | ||
API_PORT=$API_PORT ST_CONNECTION_URI=$ST_CONNECTION_URI go run . & | ||
popd | ||
|
||
frontendDriverVersion=$3 | ||
# run tests | ||
cd ../ | ||
git clone [email protected]:supertokens/backend-sdk-testing.git | ||
cd backend-sdk-testing | ||
git checkout $frontendDriverVersion | ||
npm install | ||
npm run build | ||
|
||
if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then | ||
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npx mocha --node-option no-experimental-fetch -r test/fetch-polyfill.mjs --no-config --timeout 500000 $(npx mocha-split-tests -r ./runtime.log -t $CIRCLE_NODE_TOTAL -g $CIRCLE_NODE_INDEX -f 'test/**/*.test.js') | ||
else | ||
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npm test | ||
fi | ||
|
||
# kill test-server | ||
kill $(lsof -t -i:$API_PORT) |