|
| 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 [email protected]: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