From 733d06af5ad4b90f018b3e93120e745922b59b5d Mon Sep 17 00:00:00 2001 From: Ori Newman Date: Mon, 6 Jan 2020 10:31:09 +0200 Subject: [PATCH] [NOD-617] Remove test coverage from test.sh (#569) * [NOD-617] Remove test coverage from test.sh * [NOD-617] Log coverage --- test.sh | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/test.sh b/test.sh index 8710ee254..1fb58449e 100755 --- a/test.sh +++ b/test.sh @@ -1,33 +1,15 @@ #!/bin/sh -set -e - -export COVERAGE_PATH="./coverage.txt" -export COVERAGE_TEMP_PATH="./coverage.tmp" - -# Remove the old coverage file if exists -rm -f ${COVERAGE_PATH} - -# Create a new coverage file -echo 'mode: atomic' > ${COVERAGE_PATH} - -# Test each package (excluding vendor packages) separately +# Test each package separately # Function inlining messes with monkey patching so we disable it by passing -gcflags='-l' # Running tests with -covermode=atomic saves us from race conditions unique to the testing environment -# We write coverage for every package to a temporary file so that we may append it to one global coverage file go list ./... | \ - grep -v "vendor" | \ - xargs -n1 -I{} sh -c "go test -gcflags='-l' -timeout 60s -covermode=atomic -coverprofile=${COVERAGE_TEMP_PATH} {} && tail -n +2 ${COVERAGE_TEMP_PATH} >> ${COVERAGE_PATH}" | \ - tee /tmp/test + xargs -n1 -I{} sh -c "go test -gcflags='-l' -timeout 60s -covermode=atomic -cover {}" -# Remove the temporary coverage file -rm -f ${COVERAGE_TEMP_PATH} - -# Succeed only if everything is 100% covered -grep "ok .* 100.0% of statements" -v /tmp/test > /tmp/test2 || true -if [ -s /tmp/test2 ] +retVal=$? +if [ $retVal -ne 0 ] then - echo " >> tests failed or not 100% coverage" + echo " >> tests failed" exit 1 else echo " >> tests completed successfully"