hack/integration: Add TEST_INTEGRATION_FAIL_FAST

Before this change, integration test would fail fast and not execute all
test suites when one suite fails.
Change this behavior into opt-in enabled by TEST_INTEGRATION_FAIL_FAST
variable.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 48cc28e4ef)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-07-24 15:20:31 +02:00
parent a61e2b4c9c
commit 35a8b00b18
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A
2 changed files with 11 additions and 1 deletions

View file

@ -62,6 +62,7 @@ DOCKER_ENVS := \
-e TEST_FORCE_VALIDATE \
-e TEST_INTEGRATION_DIR \
-e TEST_INTEGRATION_USE_SNAPSHOTTER \
-e TEST_INTEGRATION_FAIL_FAST \
-e TEST_SKIP_INTEGRATION \
-e TEST_SKIP_INTEGRATION_CLI \
-e TESTCOVERAGE \

View file

@ -66,6 +66,7 @@ run_test_integration() {
run_test_integration_suites() {
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
local dirs="$1"
local failed=0
for dir in ${dirs}; do
if ! (
cd "$dir"
@ -96,8 +97,16 @@ run_test_integration_suites() {
--junitfile="${ABS_DEST}/${pkgname//./-}-junit-report.xml" \
--raw-command \
-- go tool test2json -p "${pkgname}" -t ./test.main ${pkgtestflags}
); then exit 1; fi
); then
if [ -n "${TEST_INTEGRATION_FAIL_FAST}" ]; then
exit 1
fi
failed=1
fi
done
if [ $failed -eq 1 ]; then
exit 1
fi
}
build_test_suite_binaries() {