From f7782d27cc868edd33189da1cdd4cc0895ac3465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Mon, 24 Jul 2023 15:20:31 +0200 Subject: [PATCH] hack/integration: Add TEST_INTEGRATION_FAIL_FAST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 48cc28e4efc21be1d288c33a9e58417df2d28306) Signed-off-by: Paweł Gronowski --- Makefile | 1 + hack/make/.integration-test-helpers | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1993c52a91..db7e58be63 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,7 @@ DOCKER_ENVS := \ -e GITHUB_ACTIONS \ -e TEST_FORCE_VALIDATE \ -e TEST_INTEGRATION_DIR \ + -e TEST_INTEGRATION_FAIL_FAST \ -e TEST_SKIP_INTEGRATION \ -e TEST_SKIP_INTEGRATION_CLI \ -e TESTCOVERAGE \ diff --git a/hack/make/.integration-test-helpers b/hack/make/.integration-test-helpers index bbfc4edb86..ded310cf6c 100644 --- a/hack/make/.integration-test-helpers +++ b/hack/make/.integration-test-helpers @@ -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() {