Merge pull request #40110 from thaJeztah/fix_test_filter

Fix TEST_FILTER to work for both "integration" and "integration-cli"
This commit is contained in:
Brian Goff 2019-10-25 09:00:13 -07:00 committed by GitHub
commit 221012c92c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,6 @@ setup_integration_test_filter() {
if [ -z "${TEST_FILTER}" ]; then
return
fi
TESTFLAGS+="-test.run ${TEST_FILTER}"
local dirs
dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
@ -30,6 +29,8 @@ setup_integration_test_filter() {
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
TEST_SKIP_INTEGRATION=1
else
TESTFLAGS+=" -test.run ${TEST_FILTER}"
fi
fi
@ -37,12 +38,18 @@ setup_integration_test_filter() {
if echo "$dirs" | grep -vq '^./integration-cli$'; then
TEST_SKIP_INTEGRATION_CLI=1
echo "Skipping integration-cli tests since the supplied filter \"${TEST_FILTER}\" omits all integration-cli tests"
else
TESTFLAGS+=" -test.run /${TEST_FILTER}"
fi
fi
}
setup_integration_test_filter
integration_api_dirs="${TEST_INTEGRATION_DIR:-$(go list -test -f '{{- if ne .ForTest "" -}}{{- .Dir -}}{{- end -}}' ./integration/...)}"
if [ -z "${TEST_SKIP_INTEGRATION}" ] && [ -z "${TEST_INTEGRATION_DIR}" ]; then
integration_api_dirs="$(go list -test -f '{{- if ne .ForTest "" -}}{{- .Dir -}}{{- end -}}' ./integration/...)"
else
integration_api_dirs="${TEST_INTEGRATION_DIR}"
fi
run_test_integration() {
set_platform_timeout