From 96707bc600747257e82917ca079fa5006d636b2c Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 30 Aug 2017 12:01:01 -0400 Subject: [PATCH] Fix integration suite and propagate failures Failures from the integration suite were not propagating to the outter shell for some reason. Handle the failure with an if exit 1. Signed-off-by: Daniel Nephin --- Makefile | 1 + hack/make/.integration-test-helpers | 20 +++++++++++++++----- hack/make/test-integration | 2 +- integration/service/inspect_test.go | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4cf8c02cf7..7428bd32ac 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ DOCKER_ENVS := \ -e DOCKER_REMAP_ROOT \ -e DOCKER_STORAGE_OPTS \ -e DOCKER_USERLANDPROXY \ + -e TEST_INTEGRATION_DIR \ -e TESTDIRS \ -e TESTFLAGS \ -e TIMEOUT \ diff --git a/hack/make/.integration-test-helpers b/hack/make/.integration-test-helpers index 2a5bd5f218..e3cb7d84a7 100644 --- a/hack/make/.integration-test-helpers +++ b/hack/make/.integration-test-helpers @@ -8,22 +8,32 @@ source "$SCRIPTDIR/make/.go-autogen" +# Set defaults : ${TEST_REPEAT:=1} +: ${TESTFLAGS:=} +: ${TESTDEBUG:=} -integration_api_dirs=("$( +integration_api_dirs=${TEST_INTEGRATION_DIR:-"$( find ./integration -type d | - grep -vE '^(./integration$|./integration/util)')") + grep -vE '^(./integration$|./integration/util)')"} run_test_integration() { + [[ "$TESTFLAGS" != *-check.f* ]] && run_test_integration_suites + run_test_integration_legacy_suites +} + +run_test_integration_suites() { local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS" for dir in $integration_api_dirs; do - ( + if ! ( cd $dir echo "Running $PWD" test_env ./test.main $flags - ) + ); then exit 1; fi done +} +run_test_integration_legacy_suites() { ( flags="-check.v -check.timeout=${TIMEOUT} -test.timeout=360m $TESTFLAGS" cd integration-cli @@ -33,7 +43,7 @@ run_test_integration() { } build_test_suite_binaries() { - if [ $DOCKER_INTEGRATION_TESTS_VERIFIED ]; then + if [ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]; then echo "Skipping building test binaries; as DOCKER_INTEGRATION_TESTS_VERIFIED is set" return fi diff --git a/hack/make/test-integration b/hack/make/test-integration index e419d66c6e..0100ac9cc7 100755 --- a/hack/make/test-integration +++ b/hack/make/test-integration @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -e -o pipefail source "${MAKEDIR}/.go-autogen" source hack/make/.integration-test-helpers diff --git a/integration/service/inspect_test.go b/integration/service/inspect_test.go index e4459af437..239075a0fd 100644 --- a/integration/service/inspect_test.go +++ b/integration/service/inspect_test.go @@ -18,6 +18,7 @@ import ( ) func TestInspect(t *testing.T) { + defer setupTest(t)() d := newSwarm(t) defer d.Stop(t) client, err := request.NewClientForHost(d.Sock())