aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-11-01 00:51:35 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-11-01 00:51:35 -0400
commitf889d22a0ff413cdcf176625b43f329c346cd7e2 (patch)
treeb6aadb46f4ca9949bbb683e2e7e3087979753878
parent1e552d3d89bc6658c687849ab59fc62577e9fef3 (diff)
downloadstasis-f889d22a0ff413cdcf176625b43f329c346cd7e2.tar.gz
Tests: Force the removal of podman containers
-rw-r--r--tests/setup.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/setup.sh b/tests/setup.sh
index 0875cac..14d8e6d 100644
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -253,8 +253,18 @@ assert_file_contains() {
fi
}
+clean_up_docker() {
+ CONTAINERS_DIR="$WORKSPACE/.local/share/containers"
+ # HOME points to the WORKSPACE. The only reason we'd have this directory is if docker/podman was executed
+ # Fair to assume if the directory exists, docker/podman is functional.
+ if [ -d "$CONTAINERS_DIR" ]; then
+ docker run --rm -it -v $CONTAINERS_DIR:/data alpine sh -c '/bin/rm -r -f /data/*'
+ fi
+}
+
clean_up() {
- if [ -z "$RT_KEEP_WORKSPACE" ] && [ -d "$WORKSPACE" ]; then
+ if ([ -z "$RT_KEEP_WORKSPACE" ] || [ -z "$KEEP_WORKSPACE" ]) && [ -d "$WORKSPACE" ]; then
+ clean_up_docker
rm -rf "$WORKSPACE"
fi