Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions hack/test-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fi
OUTPUT_COVERAGE=${OUTPUT_COVERAGE:-""}

if [ -n "${OUTPUT_COVERAGE}" ]; then
if [ -z "${KUBE_RACE}" ]; then
if [ -z ${KUBE_RACE+x} ]; then
KUBE_RACE="-race"
fi
if [ -z "${KUBE_COVER}" ]; then
Expand All @@ -49,7 +49,7 @@ if [ -z ${KUBE_RACE+x} ]; then
KUBE_RACE=""
fi

KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 45s}
KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 60s}

if [ "${1-}" != "" ]; then
test_packages="$OS_GO_PACKAGE/$1"
Expand All @@ -68,7 +68,10 @@ if [[ -n "${KUBE_COVER}" && -n "${OUTPUT_COVERAGE}" ]]; then
KUBE_COVER_PROFILE="-coverprofile=$OUTPUT_COVERAGE/$test_package/profile.out"

go test $KUBE_RACE $KUBE_TIMEOUT $KUBE_COVER "$KUBE_COVER_PROFILE" "$test_package" "${@:2}"
done

for test_package in "${test_packages[@]}"
do
if [ -f "${OUTPUT_COVERAGE}/$test_package/profile.out" ]; then
go tool cover "-html=${OUTPUT_COVERAGE}/$test_package/profile.out" -o "${OUTPUT_COVERAGE}/$test_package/coverage.html"
echo "coverage: ${OUTPUT_COVERAGE}/$test_package/coverage.html"
Expand Down