From 5d5d984bf39deb5397ca6242c4504aa609be54471d9c928690ca7a6b3ac2a59f Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Mon, 11 Mar 2019 09:47:55 +0000 Subject: [PATCH] Accepting request 683739 from home:cyphar:containers:docker-test Improve tests.sh. OBS-URL: https://build.opensuse.org/request/show/683739 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=296 --- tests.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests.sh b/tests.sh index 9580348..fcc56fe 100644 --- a/tests.sh +++ b/tests.sh @@ -190,6 +190,10 @@ cleanup() { restore_backup "$CFG_DOCKER" systemctl restart docker.service + log "Removing images and containers..." + docker ps -aq | xargs docker rm -f + docker images -q | xargs docker rmi -f + log "Removing extra files and restoring backups..." restore_backup /etc/subuid /etc/subgid rm -f "$TESTS_DIR/contrib" "$DEST/fixtures" "$FROZEN_IMAGES_LINK" @@ -203,6 +207,10 @@ export MAKEDIR="$SCRIPTS_DIR/make" 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. +docker ps -aq | xargs docker rm -f +docker images -q | xargs docker rmi -f + # 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. log "Downlading frozen images..."