This change aims to streamline the integrationtest suite and reduce friction when running (parts of) test suites. Changes: - add `test-testname` to makefile to easily run one suite - made skipping tests first class citizen in test.sh (all available testsuites and the reasons they are skipped are now better exposed and discovered) - suppress some output of gotest unless there is an error - no longer build binary for examples and gotest suites - removed .SILENT from makefile as it being applied to only some targets makes it feel weird (I just learned about this option btw, feel free to comment on this change) - move individual tests out of `test.sh` and into `test-misc.sh` - introduced the concept of testsuites to `test.sh`
37 lines
979 B
Bash
Executable File
37 lines
979 B
Bash
Executable File
#!/bin/bash
|
|
# original version of this script from kubernetes project, under ALv2 license
|
|
|
|
echo running "$0"
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
#ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
|
|
ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
cd "${ROOT}"
|
|
. test/util.sh
|
|
|
|
#GO_VERSION=($(go version))
|
|
#
|
|
#if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4|go1.5|go1.6|go1.7|go1.8|go1.9|devel') ]]; then
|
|
# fail_test "Unknown go version '${GO_VERSION[2]}', failing gofmt."
|
|
#fi
|
|
|
|
find_files() {
|
|
git ls-files | grep '\.go$'
|
|
}
|
|
|
|
# gofmt -s -l
|
|
GOFMT="gofmt"
|
|
bad_files=$(find_files | xargs $GOFMT -s -l)
|
|
if [[ -n "${bad_files}" ]]; then
|
|
fail_test "The following golang files are not properly formatted (gofmt -s -l): ${bad_files}"
|
|
fi
|
|
#goimports -l
|
|
GOFMT="goimports"
|
|
bad_files=$(find_files | xargs $GOFMT -l)
|
|
if [[ -n "${bad_files}" ]]; then
|
|
fail_test "The following golang files are not properly formatted (goimports -l): ${bad_files}"
|
|
fi
|
|
echo 'PASS'
|