mirror of
https://github.com/containous/traefik.git
synced 2024-12-23 17:34:13 +03:00
33 lines
624 B
Bash
Executable File
33 lines
624 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if ! test -e autogen/genstatic/gen.go; then
|
|
echo >&2 'error: generate must be run before test-unit'
|
|
false
|
|
fi
|
|
|
|
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
|
|
|
|
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
|