Skip to content
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

feat: Add changes to run tests using circle ci for partial reruns #965

Merged
merged 27 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c9c593a
Add changes to run tests using circle ci for partial reruns
deepjyoti30-st Dec 3, 2024
9ae732c
Update config continue to store results for backend sdk and other tests
deepjyoti30-st Dec 3, 2024
6af557f
Update config_continue template to fix some syntax issues
deepjyoti30-st Dec 3, 2024
53e6710
Undo placeholder change to keep things same
deepjyoti30-st Dec 3, 2024
4a5c16f
Undo change for removing workflow version based on circleci linter
deepjyoti30-st Dec 3, 2024
d1be8dc
Add a print context job to debug circle ci issues
deepjyoti30-st Dec 3, 2024
fa7f8f9
Remove print context step
deepjyoti30-st Dec 3, 2024
87a5590
Add some improvements for proper partial re-run support in circle CI
deepjyoti30-st Dec 3, 2024
fc2bc47
Update test run commands to make them run without issues
deepjyoti30-st Dec 3, 2024
26a333a
Remove use of test.mocha.env in tests that don't use it
deepjyoti30-st Dec 3, 2024
0ae1349
Remove use of mocha multi in test runs
deepjyoti30-st Dec 3, 2024
902b8a5
Add some fixes to run tests more accurately in different setups
deepjyoti30-st Dec 3, 2024
978615f
Add fixes for exporting env variables properly
deepjyoti30-st Dec 3, 2024
fa2adcc
Add fixes to properly store the test results through junit
deepjyoti30-st Dec 3, 2024
8890135
Fix mocha tests with free core
deepjyoti30-st Dec 3, 2024
6b99575
Add some fixes to properly set multi variable
deepjyoti30-st Dec 3, 2024
787c017
Install mocha multi-junit-reporter package for tests
deepjyoti30-st Dec 3, 2024
57d30de
Add changes to not use absolute path for junit results
deepjyoti30-st Dec 4, 2024
d30ae63
Update mocha file environment variable to match other paths
deepjyoti30-st Dec 4, 2024
208ff60
Use a simple report name for junit result reports
deepjyoti30-st Dec 4, 2024
0332e0f
Add mocha junit file name fixes
deepjyoti30-st Dec 4, 2024
60f6538
Fix multi variable not being visible to runner
deepjyoti30-st Dec 4, 2024
8f10758
Add debug steps for checking the junit file
deepjyoti30-st Dec 4, 2024
50d8fc2
Add support for printing test-results directory for debugging
deepjyoti30-st Dec 4, 2024
1be078d
Add fix for the path for test-results
deepjyoti30-st Dec 4, 2024
874509b
Add support for proper paths for all tests
deepjyoti30-st Dec 4, 2024
c1e73c3
Remove unused parameters from unit-test job
deepjyoti30-st Dec 4, 2024
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
10 changes: 7 additions & 3 deletions .circleci/config_continue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
- 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: (cd .circleci/ && ./doUnitTests.sh << parameters.cdi-version >>)
- store_test_results:
path: ~/test_report/free-core-junit.xml
- slack/status
test-backend-sdk-testing:
docker:
Expand All @@ -75,6 +77,8 @@ jobs:
- 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: (cd .circleci/ && ./doBackendSDKTests.sh << parameters.cdi-version >> << parameters.fdi-version >>)
- store_test_results:
path: ~/backend-sdk-testing/test-results/junit.xml
porcellus marked this conversation as resolved.
Show resolved Hide resolved
- slack/status
test-website:
docker:
Expand All @@ -94,6 +98,8 @@ jobs:
- 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: (cd .circleci/ && ./website.sh << parameters.fdi-version >>)
- store_test_results:
path: ~/test_report/website-junit.xml
- slack/status
test-authreact:
docker:
Expand All @@ -103,8 +109,6 @@ jobs:
parameters:
fdi-version:
type: string
environment:
MOCHA_FILE: ~/test_report/report_node-<< parameters.fdi-version >>.xml
parallelism: 4
steps:
- checkout
Expand All @@ -125,7 +129,7 @@ jobs:
path: ~/test_report/react-logs
destination: react-logs
- store_test_results:
path: ~/test_report/report_node-<< parameters.fdi-version >>.xml
path: ~/test_report/auth-react-junit.xml
- slack/status
test-success:
docker:
Expand Down
17 changes: 12 additions & 5 deletions .circleci/setupAndTestBackendSDKWithFreeCore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 7 additions & 1 deletion .circleci/setupAndTestWithAuthReact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,14 @@ done
sleep 2 # Because the server is responding does not mean the app is ready. Let's wait another 2secs to make sure the app is up.
echo "Start mocha testing"

export MOCHA_FILE=~/test_report/auth-react-junit.xml
export multi="spec=- mocha-junit-reporter=$MOCHA_FILE"
export TEST_MODE=testing
export APP_SERVER=$apiPort
export SCREENSHOT_ROOT=~/test_report/screenshots

export SPEC_FILES=$(circleci tests glob 'test/end-to-end/**/*.test.js' 'test/unit/**/*.test.js')
echo $SPEC_FILES | SCREENSHOT_ROOT=~/test_report/screenshots APP_SERVER=$apiPort TEST_MODE=testing multi="spec=- mocha-junit-reporter=/dev/null" circleci tests run --command="xargs npx mocha mocha --reporter mocha-multi --require @babel/register --require test/test.mocha.env --timeout 40000 --no-config" --verbose --split-by=timings
echo $SPEC_FILES | circleci tests run --command="xargs npx mocha mocha --reporter mocha-multi --require @babel/register --require test/test.mocha.env --timeout 40000 --no-config" --verbose --split-by=timings

testPassed=$?;
cp ../supertokens-root/logs/error.log ~/test_report/logs/core_error.log
Expand Down
16 changes: 11 additions & 5 deletions .circleci/setupAndTestWithFreeCore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
16 changes: 11 additions & 5 deletions .circleci/setupAndTestWithFrontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading