diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2022-06-27 14:41:04 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2022-06-28 10:38:12 +0200 |
commit | 0e03a64f9956b237812ea11ecab83e1b05f025a0 (patch) | |
tree | bd53f106a992a8ea608723673feba6463c6f9c05 /test | |
parent | 0cabd8006b6ba9c123943e3072e740a9a681a1a0 (diff) | |
download | podman-0e03a64f9956b237812ea11ecab83e1b05f025a0.tar.gz podman-0e03a64f9956b237812ea11ecab83e1b05f025a0.tar.bz2 podman-0e03a64f9956b237812ea11ecab83e1b05f025a0.zip |
pod: ps does not race with rm
the "pod ps" command first retrieves the list of all pods, then
iterates over the list to inspect each pod. This introduce a race
since a pod could be deleted in the meanwhile by another process.
Solve it by ignoring the define.ErrNoSuchPod error.
Closes: https://github.com/containers/podman/issues/14736
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/system/200-pod.bats | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index f597c0e0a..92d3966be 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -495,7 +495,22 @@ spec: local actual2=$(< /sys/fs/cgroup/$path2/cpu.max) is "$actual2" "500000 100000" "resource limits set properly" run_podman --cgroup-manager=cgroupfs pod rm $name2 +} + +@test "podman pod ps doesn't race with pod rm" { + # create a few pods + for i in {0..10}; do + run_podman pod create + done + + # and delete them + $PODMAN pod rm -a & + + # pod ps should not fail while pods are deleted + run_podman pod ps -q + # wait for pod rm -a + wait } # vim: filetype=sh |