1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-23 17:34:13 +03:00
traefik/script/test-unit

29 lines
538 B
Plaintext
Raw Normal View History

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