mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ed345fb18e
Use `env -i` to very explicitly control exactly which environment variables leak into our tests. This enforces a clean separation of "build environment knobs" versus "test suite knobs". This also includes a minor tweak to how we handle starting our integration daemon, especially to catch failure to start sooner than failing tests. Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
30 lines
819 B
Bash
30 lines
819 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
DEST=$1
|
|
|
|
# subshell so that we can export PATH without breaking other things
|
|
(
|
|
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
|
|
|
|
# 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"
|
|
}
|
|
|
|
# exporting PYTHONPATH to import "docker" from our local docker-py
|
|
test_env PYTHONPATH="$dockerPy" 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
|