Skip to content

Commit

Permalink
chore: add support for running module dir tests in continuous (#8735)
Browse files Browse the repository at this point in the history
This allows to more easily invoke tests for particualar modules.
  • Loading branch information
codyoss authored Oct 16, 2023
1 parent 2105434 commit ef872d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/kokoro/continuous.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,12 @@ if [[ $KOKORO_JOB_NAME == *"continuous"* ]]; then
# CHANGED_DIRS is the list of significant top-level directories that changed,
# but weren't deleted by the current PR. CHANGED_DIRS will be empty when run on main.
CHANGED_DIRS=$(echo "$SIGNIFICANT_CHANGES" | tr ' ' '\n' | grep "/" | cut -d/ -f1 | sort -u | tr '\n' ' ' | xargs ls -d 2>/dev/null || true)
if [[ -n $TARGET_MODULE ]]; then
pushd $TARGET_MODULE > /dev/null;
runDirectoryTests
popd > /dev/null
elif [[ -z $SIGNIFICANT_CHANGES ]] || echo "$SIGNIFICANT_CHANGES" | tr ' ' '\n' | grep "^go.mod$" || [[ $CHANGED_DIRS =~ "internal" ]]; then
# If PR changes affect all submodules, then run all tests.
if [[ -z $SIGNIFICANT_CHANGES ]] || echo "$SIGNIFICANT_CHANGES" | tr ' ' '\n' | grep "^go.mod$" || [[ $CHANGED_DIRS =~ "internal" ]]; then
testAllModules
else
runDirectoryTests . # Always run base tests.
Expand Down

0 comments on commit ef872d8

Please sign in to comment.