Skip to content

test: Fix unit test timeout in CI #283

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 9 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ orbs:
slack: circleci/[email protected]
jq: circleci/[email protected]
jobs:
test:
create-test-jobs:
machine:
image: ubuntu-2204:2022.04.1
steps:
Expand Down Expand Up @@ -41,12 +41,12 @@ workflows:
version: 2
tagged-build:
jobs:
- test:
- create-test-jobs:
filters:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
- publish:
context:
- slack-notification
Expand Down
29 changes: 18 additions & 11 deletions .circleci/config_continue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ jobs:
docker:
- image: rishabhpoddar/supertokens_python_driver_testing
resource_class: large
parameters:
cdi-version:
type: string
parallelism: 4
steps:
- checkout
- run: update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-15.0.1/bin/java" 2
- run: update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-15.0.1/bin/javac" 2
- run: echo "127.0.0.1 localhost.org" >> /etc/hosts
- run: make dev-install
- run: (cd .circleci/ && ./doUnitTests.sh)
- run: (cd .circleci/ && ./doUnitTests.sh << parameters.cdi-version >>)
- slack/status
test-website-fastapi:
docker:
Expand Down Expand Up @@ -184,7 +188,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
- test-unit:
requires:
- test-dev-tag-as-not-passed
Expand All @@ -194,7 +198,10 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
matrix:
parameters:
cdi-version: placeholder
- test-website-fastapi:
requires:
- test-dev-tag-as-not-passed
Expand All @@ -204,7 +211,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
- test-website-flask:
requires:
- test-dev-tag-as-not-passed
Expand All @@ -214,7 +221,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
- test-website-django:
requires:
- test-dev-tag-as-not-passed
Expand All @@ -224,7 +231,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
- test-website-django2x:
requires:
- test-dev-tag-as-not-passed
Expand All @@ -234,7 +241,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
- test-authreact-fastapi:
requires:
- test-dev-tag-as-not-passed
Expand All @@ -244,7 +251,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
matrix:
parameters:
fdi-version: placeholder
Expand All @@ -257,7 +264,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
matrix:
parameters:
fdi-version: placeholder
Expand All @@ -270,7 +277,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
matrix:
parameters:
fdi-version: placeholder
Expand All @@ -290,4 +297,4 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test\/.*/
70 changes: 21 additions & 49 deletions .circleci/doUnitTests.sh
Original file line number Diff line number Diff line change
@@ -1,55 +1,27 @@
coreDriverJson=`cat ../coreDriverInterfaceSupported.json`
coreDriverLength=`echo $coreDriverJson | jq ".versions | length"`
coreDriverArray=`echo $coreDriverJson | jq ".versions"`
echo "got core driver relations"
echo "Starting tests for CDI $1";

frontendDriverJson=`cat ../frontendDriverInterfaceSupported.json`
frontendDriverLength=`echo $frontendDriverJson | jq ".versions | length"`
frontendDriverArray=`echo $frontendDriverJson | jq ".versions"`
echo "got frontend driver relations"

# get driver version
version=`cat ../setup.py | grep -e 'version='`
while IFS='"' read -ra ADDR; do
counter=0
for i in "${ADDR[@]}"; do
if [ $counter == 1 ]
then
version=$i
fi
counter=$(($counter+1))
done
done <<< "$version"

someTestsRan=false
i=0
while [ $i -lt $coreDriverLength ]; do
coreDriverVersion=`echo $coreDriverArray | jq ".[$i]"`
coreDriverVersion=`echo $coreDriverVersion | tr -d '"'`
i=$((i+1))
if [ -z "$SUPERTOKENS_API_KEY" ]; then
echo "SUPERTOKENS_API_KEY not set"
exit 1
fi

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" \
-H 'api-version: 0'`
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 '"')
coreDriverVersion=$1
coreDriverVersion=`echo $coreDriverVersion | tr -d '"'`

someTestsRan=true
./setupAndTestWithFreeCore.sh $coreFree $coreDriverVersion
if [[ $? -ne 0 ]]
then
echo "test failed... exiting!"
exit 1
fi
rm -rf ../../supertokens-root
done
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" \
-H 'api-version: 0'`
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 '"')

if [[ $someTestsRan = "false" ]]
./setupAndTestWithFreeCore.sh $coreFree $coreDriverVersion
if [[ $? -ne 0 ]]
then
echo "no tests ran... failing!"
echo "test failed... exiting!"
exit 1
fi
fi
rm -rf ../../supertokens-root
8 changes: 6 additions & 2 deletions .circleci/generateConfig.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
frontendDriverJson=`cat ../frontendDriverInterfaceSupported.json`
frontendDriverArray=`echo $frontendDriverJson | jq ".versions"`
frontendDriverArray=`echo $frontendDriverJson | jq -c ".versions"`

coreDriverJson=`cat ../coreDriverInterfaceSupported.json`
coreDriverArray=`echo $coreDriverJson | jq -c ".versions"`

if [ -z "$SUPERTOKENS_API_KEY" ]; then
echo "SUPERTOKENS_API_KEY missing"
exit 1;
fi

sed -i -e 's/fdi-version: placeholder/fdi-version: '`printf "%q" $frontendDriverArray`'/' config_continue.yml
sed -i -e 's/fdi-version: placeholder/fdi-version: '`printf "%s" $frontendDriverArray`'/' config_continue.yml
sed -i -e 's/cdi-version: placeholder/cdi-version: '`printf "%s" $coreDriverArray`'/' config_continue.yml