hack/test: Don't exit early when all tests are filtered out

Don't exit immediately (due to `set -e` bash behavior) when grep returns
with a non-zero exit code. Use empty dirs instead and let it print
messages about all tests being filtered out.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-08-08 13:26:31 +02:00
parent ae008570ff
commit 43956e1b71
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -25,7 +25,11 @@ setup_integration_test_filter() {
fi
local dirs
dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
local files
if files=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/); then
dirs=$(echo "$files" | xargs -I file dirname file | uniq)
fi
if [ -z "${TEST_SKIP_INTEGRATION}" ]; then
: "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')}"
if [ -z "${TEST_INTEGRATION_DIR}" ]; then