-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: test server compatible with 1.17/2.0 (#897)
* fix: test server compatible with 1.17 * fix: pr comments * fix: mfa claim * fix: version and changelog * fix: using version function for comparision * fix: circle ci scripts * fix: circle ci testing * fix: circle ci testing * fix: circle ci testing * fix: test server * fix: circle ci restore
- Loading branch information
Showing
19 changed files
with
249 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
echo "Starting tests for CDI $1"; | ||
|
||
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=node" \ | ||
-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 '"') | ||
|
||
cd .. | ||
./test/testExports.sh | ||
if [[ $? -ne 0 ]] | ||
then | ||
echo "export test failed... exiting!" | ||
exit 1 | ||
fi | ||
cd .circleci | ||
|
||
./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,81 @@ | ||
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 "Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" | ||
|
||
cd ../../ | ||
git clone git@github.com: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/ | ||
|
||
# Set the script to exit on error | ||
set -e | ||
|
||
API_PORT=3030 | ||
ST_CONNECTION_URI=http://localhost:8081 | ||
|
||
# start test-server | ||
pushd test/test-server | ||
npm install | ||
API_PORT=$API_PORT ST_CONNECTION_URI=$ST_CONNECTION_URI npm start & | ||
popd | ||
|
||
frontendDriverVersion=$3 | ||
# run tests | ||
cd ../ | ||
git clone git@github.com: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) |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.