Fix pkgs-with-tests-named.sh matching tests from subdirectories (#119501)

* Fix pkgs-with-tests-named.sh matching tests from subdirectories

The find command was recursive by default, causing packages to be
included in the results based on test functions in subdirectory packages.
Adding -maxdepth 1 matches Go's package semantics where only files in
the same directory belong to a package.

* ci: trigger integration tests for backend test script changes
This commit is contained in:
Peter Štibraný
2026-03-04 16:18:17 +01:00
committed by GitHub
parent 63ce88fdc8
commit 80b05aa67c
2 changed files with 2 additions and 1 deletions

View File

@@ -78,6 +78,7 @@ runs:
- '.github/actions/change-detection/**'
- '**.cue'
- 'devenv/docker/blocks/*_tests/**'
- 'scripts/ci/backend-tests/**'
- 'kindsv2/**'
- '${{ inputs.self }}'
frontend:

View File

@@ -60,7 +60,7 @@ fi
readarray -t PACKAGES <<< "$(go list -f '{{.Dir}}' -e "${dirs[@]}")"
for i in "${!PACKAGES[@]}"; do
readarray -t PKG_FILES <<< "$(find "${PACKAGES[$i]}" -type f -name '*_test.go')"
readarray -t PKG_FILES <<< "$(find "${PACKAGES[$i]}" -maxdepth 1 -type f -name '*_test.go')"
if [ ${#PKG_FILES[@]} -eq 0 ] || [ ${#PKG_FILES[@]} -eq 1 ] && [ -z "${PKG_FILES[0]}" ]; then
unset "PACKAGES[$i]"
continue