Skip to content

fix: restore old CI test script functionality #572

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 1 commit into from
Mar 7, 2025
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
3 changes: 2 additions & 1 deletion .circleci/config_continue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ jobs:
- checkout
- run: apt update && apt install -y bc jq lsof
- run: echo "127.0.0.1 localhost.org" >> /etc/hosts
- run: (cd .circleci/ && ./installJava.sh)
- run: python3 -m pip install pip setuptools --upgrade
- run: make dev-install
- run: .circleci/doUnitTests.sh << parameters.cdi-version >>
- run: (cd .circleci && ./doUnitTests.sh << parameters.cdi-version >>)
- store_test_results:
path: test-results/junit.xml
- slack/status
Expand Down
10 changes: 7 additions & 3 deletions .circleci/doUnitTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ 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 '"')

export SUPERTOKENS_CORE_VERSION=$(echo $coreFree | jq .core | tr -d '"')

make test
./setupAndTestWithFreeCore.sh $coreFree $coreDriverVersion
if [[ $? -ne 0 ]]
then
echo "test failed... exiting!"
exit 1
fi
70 changes: 70 additions & 0 deletions .circleci/setupAndTestWithFreeCore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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 [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

# Update oauth provider config in devConfig.yaml
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml

cd ../supertokens-plugin-interface
git checkout $pluginInterfaceTag
cd ../
echo $SUPERTOKENS_API_KEY > apiPassword
./utils/setupTestEnvLocal

# Copy the config.yaml generated by `setupTestEnv` to `supertokens-root`
cp temp/config.yaml .
# Run the java command in background
# NOTE: `doUnitTests` cannot do a cleanup of `supertokens-root` now because this command will error out
java -Djava.security.egd=file:/dev/urandom -classpath "./core/*:./plugin-interface/*" io.supertokens.Main ./ DEV host=localhost port=3567 test_mode &

cd ../project/

export INSTALL_DIR=../supertokens-root
mkdir test-results
TEST_FILES=$(circleci tests glob "**/test_*.py")
echo "$TEST_FILES" | circleci tests run --command="xargs pytest -vv -o junit_family=legacy --junitxml=test-results/junit.xml" --verbose --split-by=timings
Loading