Skip to content

Commit

Permalink
Merge pull request #15 from supertokens/feat/enable_rerunning_failed_…
Browse files Browse the repository at this point in the history
…tests

ci: enable test-splitting and rerunning failed tests
  • Loading branch information
rishabhpoddar authored Oct 29, 2024
2 parents 7abbc78 + ab7ffe2 commit a7e64b5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ spotless {
// licenseHeader '/* (C)$YEAR */'
}
}

gradle.projectsEvaluated {
subprojects {
test {
filter {
setFailOnNoMatchingTests(false)
}
}
}
}
15 changes: 14 additions & 1 deletion startTestEnv
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ if [[ $wait = true ]]; then
done
else
[[ $silent = false ]] && echo "Running all tests..."

if [[ $cicd = true ]]; then
# Get list of classnames of tests that should run on this node.
circleci tests glob "supertokens-*/src/test/**/*.java" | cut -c 1- | sed 's@/@.@g' | sed 's/.\{5\}$//' |
sed 's/^.*io\.supertokens/io.supertokens/' |
circleci tests run --command=">classnames.txt xargs echo" --verbose --split-by=timings --timings-type=classname

#if this is a re-run and it is a parallel run that does not have tests to run, halt execution of this parallel run
[ -s classnames.txt ] || circleci-agent step halt

GRADLE_ARGS=$(cat classnames.txt | awk '{for (i=1; i<=NF; i++) print "--tests",$i}')
echo "Prepared arguments for Gradle: $GRADLE_ARGS"
fi
# Tests are run relative to the project's folder
./gradlew test
./gradlew test $GRADLE_ARGS
fi

0 comments on commit a7e64b5

Please sign in to comment.