Skip to content

Commit d4ff70f

Browse files
authored
fix: restore old CI test script functionality (supertokens#572)
- CircleCI doesn't work with new docker setup - Docker daemon doesn't run well in the container - Restores old script functionality with some changes - Copies the `config.yaml` and sets up core in test script - Removes `supertokens-root` cleanup step - deleting the root dir causes failures
1 parent ac49284 commit d4ff70f

File tree

3 files changed

+79
-4
lines changed

3 files changed

+79
-4
lines changed

.circleci/config_continue.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ jobs:
2525
- checkout
2626
- run: apt update && apt install -y bc jq lsof
2727
- run: echo "127.0.0.1 localhost.org" >> /etc/hosts
28+
- run: (cd .circleci/ && ./installJava.sh)
2829
- run: python3 -m pip install pip setuptools --upgrade
2930
- run: make dev-install
30-
- run: .circleci/doUnitTests.sh << parameters.cdi-version >>
31+
- run: (cd .circleci && ./doUnitTests.sh << parameters.cdi-version >>)
3132
- store_test_results:
3233
path: test-results/junit.xml
3334
- slack/status

.circleci/doUnitTests.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ then
1616
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."
1717
exit 1
1818
fi
19+
coreFree=$(echo $coreFree | jq .core | tr -d '"')
1920

20-
export SUPERTOKENS_CORE_VERSION=$(echo $coreFree | jq .core | tr -d '"')
21-
22-
make test
21+
./setupAndTestWithFreeCore.sh $coreFree $coreDriverVersion
22+
if [[ $? -ne 0 ]]
23+
then
24+
echo "test failed... exiting!"
25+
exit 1
26+
fi

.circleci/setupAndTestWithFreeCore.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
coreInfo=`curl -s -X GET \
2+
"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \
3+
-H 'api-version: 0'`
4+
if [[ `echo $coreInfo | jq .tag` == "null" ]]
5+
then
6+
echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo"
7+
exit 1
8+
fi
9+
coreTag=$(echo $coreInfo | jq .tag | tr -d '"')
10+
coreVersion=$(echo $coreInfo | jq .version | tr -d '"')
11+
12+
pluginInterfaceVersionXY=`curl -s -X GET \
13+
"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \
14+
-H 'api-version: 0'`
15+
if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]]
16+
then
17+
echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY"
18+
exit 1
19+
fi
20+
pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"')
21+
22+
pluginInterfaceInfo=`curl -s -X GET \
23+
"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \
24+
-H 'api-version: 0'`
25+
if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]]
26+
then
27+
echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo"
28+
exit 1
29+
fi
30+
pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"')
31+
pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"')
32+
33+
echo "Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion"
34+
35+
cd ../../
36+
git clone git@github.com:supertokens/supertokens-root.git
37+
cd supertokens-root
38+
if [[ $2 == "2.0" ]] || [[ $2 == "2.1" ]] || [[ $2 == "2.2" ]]
39+
then
40+
git checkout 36e5af1b9a4e3b07247d0cf333cf82a071a78681
41+
fi
42+
echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
43+
./loadModules --ssh
44+
cd supertokens-core
45+
git checkout $coreTag
46+
47+
# Update oauth provider config in devConfig.yaml
48+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
49+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
50+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
51+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
52+
53+
cd ../supertokens-plugin-interface
54+
git checkout $pluginInterfaceTag
55+
cd ../
56+
echo $SUPERTOKENS_API_KEY > apiPassword
57+
./utils/setupTestEnvLocal
58+
59+
# Copy the config.yaml generated by `setupTestEnv` to `supertokens-root`
60+
cp temp/config.yaml .
61+
# Run the java command in background
62+
# NOTE: `doUnitTests` cannot do a cleanup of `supertokens-root` now because this command will error out
63+
java -Djava.security.egd=file:/dev/urandom -classpath "./core/*:./plugin-interface/*" io.supertokens.Main ./ DEV host=localhost port=3567 test_mode &
64+
65+
cd ../project/
66+
67+
export INSTALL_DIR=../supertokens-root
68+
mkdir test-results
69+
TEST_FILES=$(circleci tests glob "**/test_*.py")
70+
echo "$TEST_FILES" | circleci tests run --command="xargs pytest -vv -o junit_family=legacy --junitxml=test-results/junit.xml" --verbose --split-by=timings

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy