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
This commit is contained in:
Aleksa Sarai 2019-03-11 09:47:55 +00:00 committed by Git OBS Bridge
parent b94112cc9d
commit 5d5d984bf3

View File

@ -190,6 +190,10 @@ cleanup() {
restore_backup "$CFG_DOCKER" restore_backup "$CFG_DOCKER"
systemctl restart docker.service 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..." log "Removing extra files and restoring backups..."
restore_backup /etc/subuid /etc/subgid restore_backup /etc/subuid /etc/subgid
rm -f "$TESTS_DIR/contrib" "$DEST/fixtures" "$FROZEN_IMAGES_LINK" 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" export DOCKER_HOST="$DOCKER_TEST_HOST"
bundle .integration-daemon-setup 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 # 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.
log "Downlading frozen images..." log "Downlading frozen images..."