-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add changes to run tests using circle ci for partial reruns (#965)
* Add changes to run tests using circle ci for partial reruns * Update config continue to store results for backend sdk and other tests * Update config_continue template to fix some syntax issues * Undo placeholder change to keep things same * Undo change for removing workflow version based on circleci linter * Add a print context job to debug circle ci issues * Remove print context step * Add some improvements for proper partial re-run support in circle CI * Update test run commands to make them run without issues * Remove use of test.mocha.env in tests that don't use it * Remove use of mocha multi in test runs * Add some fixes to run tests more accurately in different setups * Add fixes for exporting env variables properly * Add fixes to properly store the test results through junit * Fix mocha tests with free core * Add some fixes to properly set multi variable * Install mocha multi-junit-reporter package for tests * Add changes to not use absolute path for junit results * Update mocha file environment variable to match other paths * Use a simple report name for junit result reports * Add mocha junit file name fixes * Fix multi variable not being visible to runner * Add debug steps for checking the junit file * Add support for printing test-results directory for debugging * Add fix for the path for test-results * Add support for proper paths for all tests * Remove unused parameters from unit-test job
- Loading branch information
1 parent
7e33a06
commit af56de2
Showing
5 changed files
with
48 additions
and
19 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 |
---|---|---|
|
@@ -105,13 +105,20 @@ git clone [email protected]:supertokens/backend-sdk-testing.git | |
cd backend-sdk-testing | ||
git checkout $frontendDriverVersion | ||
npm install | ||
npm i mocha-multi mocha-junit-reporter | ||
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 | ||
export API_PORT=$API_PORT | ||
export TEST_MODE=testing | ||
export SUPERTOKENS_CORE_TAG=$coreTag | ||
export NODE_PORT=8081 | ||
export INSTALL_PATH=../supertokens-root | ||
export MOCHA_FILE=test-results/junit.xml | ||
export multi="spec=- mocha-junit-reporter=$MOCHA_FILE" | ||
|
||
mkdir -p test-results | ||
TEST_FILES=$(circleci tests glob "test/**/*.test.js") | ||
echo "$TEST_FILES" | circleci tests run --command="xargs npx mocha mocha --reporter mocha-multi --node-option no-experimental-fetch -r test/fetch-polyfill.mjs --timeout 500000 --no-config" --verbose --split-by=timings | ||
|
||
# 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
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 |
---|---|---|
|
@@ -60,6 +60,7 @@ then | |
fi | ||
echo "Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" | ||
|
||
mkdir -p ~/test_report | ||
cd ../../ | ||
git clone [email protected]:supertokens/supertokens-root.git | ||
cd supertokens-root | ||
|
@@ -84,12 +85,17 @@ cd ../ | |
echo $SUPERTOKENS_API_KEY > apiPassword | ||
./utils/setupTestEnvLocal | ||
cd ../project/ | ||
npm i mocha-multi mocha-junit-reporter | ||
|
||
# Set the script to exit on error | ||
set -e | ||
|
||
if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then | ||
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 | ||
TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npm test | ||
fi | ||
export TEST_MODE=testing | ||
export SUPERTOKENS_CORE_TAG=$coreTag | ||
export NODE_PORT=8081 | ||
export INSTALL_PATH=../supertokens-root | ||
export MOCHA_FILE=~/test_report/free-core-junit.xml | ||
export multi="spec=- mocha-junit-reporter=$MOCHA_FILE" | ||
|
||
TEST_FILES=$(circleci tests glob "test/**/*.test.js") | ||
echo "$TEST_FILES" | circleci tests run --command="xargs npx mocha mocha --reporter mocha-multi --node-option no-experimental-fetch --timeout 40000 --no-config" --verbose --split-by=timings |
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 |
---|---|---|
|
@@ -61,6 +61,8 @@ fi | |
|
||
echo "Testing with frontend website: $2, FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" | ||
|
||
mkdir -p ~/test_report | ||
|
||
cd ../../ | ||
git clone [email protected]:supertokens/supertokens-root.git | ||
cd supertokens-root | ||
|
@@ -96,11 +98,15 @@ npm i | |
cd ../../ | ||
npm i -d | ||
|
||
if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then | ||
TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npx mocha --exit --no-config --require isomorphic-fetch --timeout 500000 $(npx mocha-split-tests -r ./runtime.log -t $CIRCLE_NODE_TOTAL -g $CIRCLE_NODE_INDEX -f 'test/*.test.js') | ||
else | ||
TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npm test | ||
fi | ||
export TEST_MODE=testing | ||
export SUPERTOKENS_CORE_TAG=$coreTag | ||
export NODE_PORT=8081 | ||
export INSTALL_PATH=../supertokens-root | ||
export MOCHA_FILE=~/test_report/website-junit.xml | ||
export multi="spec=- mocha-junit-reporter=$MOCHA_FILE" | ||
|
||
TEST_FILES=$(circleci tests glob "test/*.test.js") | ||
echo "$TEST_FILES" | circleci tests run --command="xargs npx mocha npx mocha --exit --reporter mocha-multi --no-config --require isomorphic-fetch --timeout 500000" --verbose --split-by=timings | ||
|
||
if [[ $? -ne 0 ]] | ||
then | ||
|