test, integration: Add an integration test framework

This adds an initial implementation of an integration test framework for
writing more complicated tests. In particular this also makes some small
additions to the mgmt core so that testing is easier.
This commit is contained in:
James Shubin
2018-03-08 21:56:08 -05:00
parent 97c11c18d0
commit f3b99b3940
11 changed files with 778 additions and 17 deletions

View File

@@ -14,13 +14,22 @@ function run-test()
}
base=$(go list .)
for pkg in `go list -e ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/examples/" | grep -v "^${base}/test/" | grep -v "^${base}/old/" | grep -v "^${base}/tmp/"`; do
echo -e "\ttesting: $pkg"
run-test go test "$pkg"
if [ "$1" = "--race" ]; then
run-test go test -race "$pkg"
if [[ "$@" = *"--integration"* ]]; then
if [[ "$@" = *"--race"* ]]; then
run-test go test -race "${base}/integration/"
else
run-test go test "${base}/integration/"
fi
done
else
for pkg in `go list -e ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/examples/" | grep -v "^${base}/test/" | grep -v "^${base}/old/" | grep -v "^${base}/tmp/" | grep -v "^${base}/integration"`; do
echo -e "\ttesting: $pkg"
if [[ "$@" = *"--race"* ]]; then
run-test go test -race "$pkg"
else
run-test go test "$pkg"
fi
done
fi
if [[ -n "$failures" ]]; then
echo 'FAIL'