Skip to content

Commit

Permalink
Properly fix "daemon kill" on test failure
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
  • Loading branch information
tianon committed Jan 14, 2015
1 parent 0db6bb3 commit c18fdc3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
25 changes: 17 additions & 8 deletions project/make/test-docker-py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,24 @@ DEST=$1
(
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"

dockerPy='/docker-py'
[ -d "$dockerPy" ] || {
dockerPy="$DEST/docker-py"
git clone https://github.com/docker/docker-py.git "$dockerPy"
}
# we need to wrap up everything in between integration-daemon-start and
# integration-daemon-stop to make sure we kill the daemon and don't hang,
# even and especially on test failures
didFail=
if ! {
dockerPy='/docker-py'
[ -d "$dockerPy" ] || {
dockerPy="$DEST/docker-py"
git clone https://github.com/docker/docker-py.git "$dockerPy"
}

cd "$dockerPy"
export PYTHONPATH=. # import "docker" from "."
python tests/integration_test.py
export PYTHONPATH="$dockerPy" # import "docker" from our local docker-py
python "$dockerPy/tests/integration_test.py"
}; then
didFail=1
fi

source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop"

[ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a $DEST/test.log
18 changes: 14 additions & 4 deletions project/make/test-integration-cli
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ bundle_test_integration_cli() {
(
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"

# pull the busybox image before running the tests
sleep 2
# we need to wrap up everything in between integration-daemon-start and
# integration-daemon-stop to make sure we kill the daemon and don't hang,
# even and especially on test failures
didFail=
if ! {
# pull the busybox image before running the tests
sleep 2

source "$(dirname "$BASH_SOURCE")/.ensure-busybox"
source "$(dirname "$BASH_SOURCE")/.ensure-busybox"

bundle_test_integration_cli
bundle_test_integration_cli
}; then
didFail=1
fi

source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop"

[ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a $DEST/test.log

0 comments on commit c18fdc3

Please sign in to comment.