Aleksa Sarai 2019-03-11 12:47:45 +00:00 committed by Git OBS Bridge
parent 1dba49a151
commit aa8b889eb5

View File

@ -86,7 +86,7 @@ require_git() { git version >/dev/null 2>&1 ; }
################################################################################ ################################################################################
[ "${#TESTS[@]}" -eq 0 ] || abort "integration tests executable not found in $DOCKER_DIR" [ "${#TESTS[@]}" -gt 0 ] || abort "integration tests executable not found in $DOCKER_DIR"
[ "$EUID" -eq 0 ] || abort "this script must be run as root" [ "$EUID" -eq 0 ] || abort "this script must be run as root"
[ -n "$VERSION" ] || abort "could not obtain version" [ -n "$VERSION" ] || abort "could not obtain version"
@ -191,8 +191,8 @@ cleanup() {
systemctl restart docker.service systemctl restart docker.service
log "Removing images and containers..." log "Removing images and containers..."
docker ps -aq | xargs docker rm -f docker ps -aq | xargs docker rm -f &>/dev/null || :
docker images -q | xargs docker rmi -f docker images -q | xargs docker rmi -f &>/dev/null || :
log "Removing extra files and restoring backups..." log "Removing extra files and restoring backups..."
restore_backup /etc/subuid /etc/subgid restore_backup /etc/subuid /etc/subgid
@ -202,14 +202,16 @@ trap cleanup EXIT
cd "$DOCKER_DIR" cd "$DOCKER_DIR"
log "Preparing the environment..."
export MAKEDIR="$SCRIPTS_DIR/make" export MAKEDIR="$SCRIPTS_DIR/make"
export DOCKER_HOST="$DOCKER_TEST_HOST" export DOCKER_HOST="$DOCKER_TEST_HOST"
bundle .integration-daemon-setup
# Clean up all images on the host -- this is key to avoid test run failures. # Clean up all images on the host -- this is key to avoid test run failures.
docker ps -aq | xargs docker rm -f log "Cleaning the environment..."
docker images -q | xargs docker rmi -f docker ps -aq | xargs docker rm -f &>/dev/null || :
docker images -q | xargs docker rmi -f &>/dev/null || :
log "Preparing the environment..."
bundle .integration-daemon-setup
# XXX: Really this should be sourced from the Dockerfile but this is good # XXX: Really this should be sourced from the Dockerfile but this is good
# enough for now. This comes from the Docker 18.09.1-ce Dockerfile. # enough for now. This comes from the Docker 18.09.1-ce Dockerfile.
@ -223,11 +225,12 @@ ln -sf "$FROZEN_IMAGES_DIR" "$FROZEN_IMAGES_LINK"
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \ debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
rm "$TEST_LOG"
for TEST in "${TESTS[@]}" for TEST in "${TESTS[@]}"
do do
cd "$(dirname "$TEST")" cd "$(dirname "$TEST")"
log "Running integration test ($TEST)..." | tee -a "$TEST_LOG" log "Running integration test ($TEST)..." | tee -a "$TEST_LOG"
"$TEST" "${TEST_ARGS[@]}" 2>&1 | tee -a "$TEST_LOG" || /bin/true "$TEST" "${TEST_ARGS[@]}" 2>&1 | tee -a "$TEST_LOG" || :
done done
if [ -n "$ENABLE_XUNIT" ] ; then if [ -n "$ENABLE_XUNIT" ] ; then
log "Generating xunit logs..." log "Generating xunit logs..."