From a9741f109092af48b15254ab1aee3ba9321e2fa7 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 18 Nov 2015 14:13:15 +0100 Subject: [PATCH 1/5] build before ITs Signed-off-by: David Gageot --- mk/test.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/test.mk b/mk/test.mk index 62a0d8b237..9c028729f1 100644 --- a/mk/test.mk +++ b/mk/test.mk @@ -6,7 +6,7 @@ test-short: test-long: $(GO) test $(VERBOSE_GO) -race -tags "$(BUILDTAGS)" $(PKGS) -test-integration: +test-integration: build $(eval TESTSUITE=$(filter-out $@,$(MAKECMDGOALS))) test/integration/run-bats.sh $(TESTSUITE) From 65d04ea6c7b2ed04ca515b55b425d11f40c1c7d5 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 18 Nov 2015 14:36:02 +0100 Subject: [PATCH 2/5] Fix test because the error was changed Signed-off-by: David Gageot --- test/integration/core/core-commands.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/core/core-commands.bats b/test/integration/core/core-commands.bats index 327ce7134e..9d236f733e 100644 --- a/test/integration/core/core-commands.bats +++ b/test/integration/core/core-commands.bats @@ -6,7 +6,7 @@ load ${BASE_TEST_DIR}/helpers.bash run machine inspect $NAME echo ${output} [ "$status" -eq 1 ] - [[ ${lines[0]} == "Host \"$NAME\" does not exist" ]] + [[ ${lines[0]} =~ "Host does not exist: \"$NAME\"" ]] } @test "$DRIVER: create" { From 36cf498fb2b788242dd4321a94699751c3ca1cea Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 18 Nov 2015 14:54:12 +0100 Subject: [PATCH 3/5] Use a different machine name for each time This makes ITs more isolated and more robust Signed-off-by: David Gageot --- test/integration/run-bats.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/run-bats.sh b/test/integration/run-bats.sh index 96072e0f22..14a9d59200 100755 --- a/test/integration/run-bats.sh +++ b/test/integration/run-bats.sh @@ -26,6 +26,8 @@ function machine() { function run_bats() { for bats_file in $(find "$1" -name \*.bats); do + export NAME="bats-$DRIVER-test-$(date +%s)" + # BATS returns non-zero to indicate the tests have failed, we shouldn't # neccesarily bail in this case, so that's the reason for the e toggle. set +e @@ -62,7 +64,6 @@ fi # TODO: Should the script bail out if these are set already? export BASE_TEST_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) export MACHINE_ROOT="$BASE_TEST_DIR/../.." -export NAME="bats-$DRIVER-test" export MACHINE_STORAGE_PATH="/tmp/machine-bats-test-$DRIVER" export MACHINE_BIN_NAME=docker-machine export BATS_LOG="$MACHINE_ROOT/bats.log" From 93f94d9521b757b4aa2d49978fb5ac84584aaff6 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 18 Nov 2015 15:54:49 +0100 Subject: [PATCH 4/5] Fix an integration test Signed-off-by: David Gageot --- test/integration/core/arbitrary-engine-options.bats | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/core/arbitrary-engine-options.bats b/test/integration/core/arbitrary-engine-options.bats index f7703bde56..94bd08597e 100644 --- a/test/integration/core/arbitrary-engine-options.bats +++ b/test/integration/core/arbitrary-engine-options.bats @@ -14,5 +14,6 @@ load ${BASE_TEST_DIR}/helpers.bash docker $(machine config $NAME) run --name nolog busybox echo this should not be logged run docker $(machine config $NAME) logs nolog echo ${output} - [ $status -eq 1 ] + [ $status -eq 0 ] + [[ ${lines[0]} =~ "no log driver named 'none' is registered" ]] } From f0740fe8adff6bab31148157c692e07c68c50ce5 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 18 Nov 2015 16:27:13 +0100 Subject: [PATCH 5/5] FIX #2190 no need killing docker-machine processes Signed-off-by: David Gageot --- test/integration/run-bats.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/integration/run-bats.sh b/test/integration/run-bats.sh index 14a9d59200..b50b97b986 100755 --- a/test/integration/run-bats.sh +++ b/test/integration/run-bats.sh @@ -85,11 +85,4 @@ if [[ -d "$MACHINE_STORAGE_PATH" ]]; then rm -r "$MACHINE_STORAGE_PATH" fi -set +e -pkill docker-machine -if [[ $? -eq 0 ]]; then - EXIT_STATUS=1 -fi -set -e - exit ${EXIT_STATUS}