moby/hack/make/.integration-daemon-stop
Tibor Vass 78207d5380
hack: unmount leftover daemon root folders
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 13df617d4c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-19 18:57:58 +02:00

30 lines
875 B
Bash

#!/usr/bin/env bash
if [ ! "$(go env GOOS)" = 'windows' ]; then
for pidFile in $(find "$DEST" -name docker.pid); do
pid=$([ -n "$TESTDEBUG" ] && set -x; cat "$pidFile")
(
[ -n "$TESTDEBUG" ] && set -x
kill "$pid"
)
if ! wait "$pid"; then
echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code"
fi
root=$(dirname "$pidFile")/root
umount "$root" || true
done
if [ -z "$DOCKER_TEST_HOST" ]; then
# Stop apparmor if it is enabled
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
(
[ -n "$TESTDEBUG" ] && set -x
/etc/init.d/apparmor stop
)
fi
fi
else
# Note this script is not actionable on Windows to Linux CI. Instead the
# DIND daemon under test is torn down by the Jenkins tear-down script
echo "INFO: Not stopping daemon on Windows CI"
fi