traefik/script/test-unit
Antoine 70359e5d27
Replace go-bindata with Go embed
Co-authored-by: nrwiersma <nick@wiersma.co.za>
2021-09-15 10:36:14 +02:00

28 lines
538 B
Bash
Executable file

#!/usr/bin/env bash
set -e
RED=$'\033[31m'
GREEN=$'\033[32m'
TEXTRESET=$'\033[0m' # reset the foreground colour
# -failfast -timeout=5m
TESTFLAGS=(-cover "-coverprofile=cover.out" "${TESTFLAGS}")
if [ -n "$VERBOSE" ]; then
TESTFLAGS+=(-v)
elif [ -n "$VERBOSE_UNIT" ]; then
TESTFLAGS+=(-v)
fi
set +e
# shellcheck disable=SC2086
go test ${TESTFLAGS[*]} ./pkg/...
CODE=$?
if [ ${CODE} != 0 ]; then
echo "${RED}Tests failed [code ${CODE}].${TEXTRESET}"
exit ${CODE}
else
echo "${GREEN}Tests succeed.${TEXTRESET}"
fi