summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-06-29 19:51:53 +0000
committerGitHub <noreply@github.com>2022-06-29 19:51:53 +0000
commit2cc3f127f4f419c107c0b92c6f6457f5faad2e1d (patch)
treee4c3272cd93eb10ea39c9bc4f0f0f72fce2e389f /test
parentd6cdb996bce10eb050e41b2050aaf52d9bfd3bd0 (diff)
parent3619f0be9514cd7a2cbdddc6cfb8bc8b7a94485d (diff)
downloadpodman-2cc3f127f4f419c107c0b92c6f6457f5faad2e1d.tar.gz
podman-2cc3f127f4f419c107c0b92c6f6457f5faad2e1d.tar.bz2
podman-2cc3f127f4f419c107c0b92c6f6457f5faad2e1d.zip
Merge pull request #14720 from sstosh/rm-option
Fix: Prevent OCI runtime directory remain
Diffstat (limited to 'test')
-rw-r--r--test/system/050-stop.bats15
-rw-r--r--test/system/055-rm.bats10
2 files changed, 25 insertions, 0 deletions
diff --git a/test/system/050-stop.bats b/test/system/050-stop.bats
index c2dfba84d..39002512b 100644
--- a/test/system/050-stop.bats
+++ b/test/system/050-stop.bats
@@ -171,4 +171,19 @@ load helpers
run_podman --noout stop -t 0 stopme
is "$output" "" "output should be empty"
}
+
+@test "podman stop, with --rm container" {
+ OCIDir=/run/$(podman_runtime)
+
+ if is_rootless; then
+ OCIDir=/run/user/$(id -u)/$(podman_runtime)
+ fi
+
+ run_podman run --rm -d --name rmstop $IMAGE sleep infinity
+ local cid="$output"
+ run_podman stop rmstop
+
+ # Check the OCI runtime directory has removed.
+ is "$(ls $OCIDir | grep $cid)" "" "The OCI runtime directory should have been removed"
+}
# vim: filetype=sh
diff --git a/test/system/055-rm.bats b/test/system/055-rm.bats
index 69663fafa..0ef2216b8 100644
--- a/test/system/055-rm.bats
+++ b/test/system/055-rm.bats
@@ -52,10 +52,20 @@ load helpers
}
@test "podman rm <-> run --rm race" {
+ OCIDir=/run/$(podman_runtime)
+
+ if is_rootless; then
+ OCIDir=/run/user/$(id -u)/$(podman_runtime)
+ fi
+
# A container's lock is released before attempting to stop it. This opens
# the window for race conditions that led to #9479.
run_podman run --rm -d $IMAGE sleep infinity
+ local cid="$output"
run_podman rm -af
+
+ # Check the OCI runtime directory has removed.
+ is "$(ls $OCIDir | grep $cid)" "" "The OCI runtime directory should have been removed"
}
@test "podman rm --depend" {