-
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.
fix: test server for backend-sdk-testing (#422)
* fix: domains in apiversion call * fix: boxy validation * fix: IncludeInNonPublicTenantsByDefault in provider input * fix: test server for backend-sdk-testing * fix: thirdparty and multitenancy * fix: jwks url fix * fix: jwks cache and test fixes * fix: changelog and version * fix: circle ci * fix: generateConfig * fix: update circle ci image * fix: go script * fix: go install * fix: go version * fix: go.mod * fix: circle ci script restore * fix: pre commit * fix: pre commit * fix: pre commit * fix: pr comment * fix: pr comment * fix: pr comment * fix: pre commit * fix: pre commit * fix: pre commit * fix: pre commit * fix: not exposing new session function used in test server * fix: pr comments * fix: pre commit hook * fix: contributing
- Loading branch information
Showing
48 changed files
with
2,540 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
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
coreDriverJson=`cat ../coreDriverInterfaceSupported.json` | ||
coreDriverArray=`echo $coreDriverJson | jq ".versions"` | ||
|
||
frontendDriverJson=`cat ../frontendDriverInterfaceSupported.json` | ||
frontendDriverArray=`echo $frontendDriverJson | jq ".versions"` | ||
|
||
if [ -z "$SUPERTOKENS_API_KEY" ]; then | ||
echo "SUPERTOKENS_API_KEY missing" | ||
exit 1; | ||
fi | ||
|
||
sed -i -e 's/cdi-version: placeholder/cdi-version: '`printf "%q" $coreDriverArray`'/' config_continue.yml | ||
sed -i -e 's/fdi-version: placeholder/fdi-version: '`printf "%q" $frontendDriverArray`'/' config_continue.yml |
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,78 @@ | ||
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 | ||
sh setup-for-test.sh | ||
API_PORT=$API_PORT ST_CONNECTION_URI=$ST_CONNECTION_URI /usr/local/go/bin/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) |
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 |
---|---|---|
|
@@ -3,18 +3,21 @@ on: [pull_request] | |
jobs: | ||
go_mod_tidy_job: | ||
runs-on: ubuntu-latest | ||
container: rishabhpoddar/supertokens_go_driver_testing | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# When using actions/checkout in a custom container, the directory is not treated as a git repo and does not have a .git directory, therefore we need to initialize it as a git repo. This will allows us to track changes made after go mod tidy runs | ||
- name: Set up go | ||
uses: actions/setup-go@v5 | ||
- name: Create a new git repository | ||
run: git init && git add --all && git -c user.name='test' -c user.email='[email protected]' commit -m 'init for pr action' | ||
- name: Install latest go | ||
run: wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go*.tar.gz && export PATH=$PATH:/usr/local/go/bin && rm go1.21.3.linux-amd64.tar.gz | ||
run: rm -rf .git && git init && git add --all && git -c user.name='test' -c user.email='[email protected]' commit -m 'init for pr action' | ||
- name: Go mod tidy for root project | ||
run: go mod tidy | ||
- name: Go mod tidy for example apps | ||
working-directory: ./examples | ||
run: go mod tidy | ||
- name: Go mod tidy for test server | ||
working-directory: ./test/test-server | ||
run: go mod tidy | ||
- name: git status | ||
run: git status | ||
- name: Check for file changes by go mod tidy | ||
run: git status | grep -q 'nothing to commit, working directory clean' && exit 0 || exit 1 | ||
run: git status | grep -q 'nothing to commit, working tree clean' && exit 0 || exit 1 |
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 |
---|---|---|
|
@@ -12,14 +12,11 @@ jobs: | |
pr-title: | ||
name: Pre commit hook check | ||
runs-on: ubuntu-latest | ||
container: rishabhpoddar/supertokens_go_driver_testing | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up node | ||
uses: actions/setup-node@v1 | ||
- name: Set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
node-version: '12' | ||
- run: git init && git add --all && git -c user.name='test' -c user.email='[email protected]' commit -m 'init for pr action' | ||
- name: Install latest go | ||
run: wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go*.tar.gz && export PATH=$PATH:/usr/local/go/bin && rm go1.21.3.linux-amd64.tar.gz | ||
go-version: '1.18' | ||
- run: rm -rf .git && git init && git add --all && git -c user.name='test' -c user.email='[email protected]' commit -m 'init for pr action' | ||
- run: ./hooks/pre-commit.sh |
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 |
---|---|---|
|
@@ -23,3 +23,8 @@ releasePassword | |
.vscode/ | ||
.idea/ | ||
/test_report | ||
|
||
build-errors.log | ||
main | ||
|
||
recipe/**/*_for_test_server.go |
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.