From ddaef08c7bb419c193ec73f69718b361494e388c Mon Sep 17 00:00:00 2001 From: Thomas Gummerer Date: Thu, 22 Feb 2024 16:52:46 +0100 Subject: [PATCH] set pipefail option when running tests When running the tests in CI, we're piping the output of `go test` into gotestfmt to get prettier output. This works because `gotestfmt` will return a non-zero exit code when there are test failures. However when there are other failures, e.g. compilation of the tests failed, `gotestfmt` will have a 0 exit code. `go test` wouldn't, but because we're piping the results through, the shell swallows that unless we're setting the pipefail option. Set up the pipefail option here, so tests aren't accidentally green when compilation fails. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cf4d080942..c1cd833fbf 100644 --- a/Makefile +++ b/Makefile @@ -13,15 +13,15 @@ lint: tslint -c tslint.json **/*.ts only_test: - cd misc/test && go test -json ./... --timeout 4h -v -count=1 -short -parallel 40 --tags=all | gotestfmt + set -o pipefail && cd misc/test && go test -json ./... --timeout 4h -v -count=1 -short -parallel 40 --tags=all | gotestfmt specific_test_set: echo "running $(TestSet) Acceptance Tests" - cd misc/test && go test -json . --timeout 4h -v -count=1 -short -parallel 40 --tags=all --run=TestAcc$(TestSet) | gotestfmt + set -o pipefail && cd misc/test && go test -json . --timeout 4h -v -count=1 -short -parallel 40 --tags=all --run=TestAcc$(TestSet) | gotestfmt specific_tag_set: echo "running $(TagSet)$(TestSet) Acceptance Tests" - cd misc/test && go test -json . --timeout 4h -v -count=1 -short -parallel 40 --tags=$(TagSet) --run=TestAcc$(TagSet)$(TestSet) | gotestfmt + set -o pipefail && cd misc/test && go test -json . --timeout 4h -v -count=1 -short -parallel 40 --tags=$(TagSet) --run=TestAcc$(TagSet)$(TestSet) | gotestfmt performance_test_set: cd misc/test && go test . --timeout 4h -count=1 -short -parallel 40 --tags=Performance