mirror of
https://github.com/containers/podman.git
synced 2025-05-18 15:47:51 +08:00
CI: mark 320-system-df *NOT* parallel safe
...because it requires 100% control and knowledge of the state of all images, containers, and volumes. Use safename anyway, just in case we ever have a leak from here. I'm finding safename sooooooo helpful when reading journal. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -2,23 +2,19 @@
|
||||
#
|
||||
# tests for podman system df
|
||||
#
|
||||
# DO NOT PARALLELIZE. All of these tests require complete control of images.
|
||||
#
|
||||
|
||||
load helpers
|
||||
|
||||
function setup() {
|
||||
# Depending on which tests have been run prior to getting here, there
|
||||
# may be one or two images loaded. We want only '$IMAGE', not the
|
||||
# systemd one.
|
||||
run_podman rmi -f $SYSTEMD_IMAGE
|
||||
|
||||
basic_setup
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
basic_teardown
|
||||
|
||||
# In case the active-volumes test failed: clean up stray volumes
|
||||
function setup_file() {
|
||||
# Pristine setup: no pods, containers, volumes, images
|
||||
run_podman pod rm -a -f
|
||||
run_podman rm -f -a -t0
|
||||
run_podman volume rm -a
|
||||
run_podman image rm -f -a
|
||||
|
||||
_prefetch $IMAGE
|
||||
}
|
||||
|
||||
@test "podman system df - basic functionality" {
|
||||
@ -40,8 +36,11 @@ function teardown() {
|
||||
|
||||
@test "podman system df --format json functionality" {
|
||||
# Run two dummy containers, one which exits, one which stays running
|
||||
run_podman run --name stoppedcontainer $IMAGE true
|
||||
run_podman run -d --name runningcontainer $IMAGE top
|
||||
cname_stopped=c-stopped-$(safename)
|
||||
cname_running=c-running-$(safename)
|
||||
|
||||
run_podman run --name $cname_stopped $IMAGE true
|
||||
run_podman run -d --name $cname_running $IMAGE top
|
||||
run_podman system df --format json
|
||||
local results="$output"
|
||||
|
||||
@ -88,12 +87,14 @@ Size | ~${size}.*MB | !0B | 0B
|
||||
done < <(parse_table "$tests")
|
||||
|
||||
# Clean up
|
||||
run_podman rm -f -t 0 stoppedcontainer runningcontainer
|
||||
run_podman rm -f -t 0 $cname_stopped $cname_running
|
||||
}
|
||||
|
||||
@test "podman system df - with active containers and volumes" {
|
||||
run_podman run -v /myvol1 --name c1 $IMAGE true
|
||||
run_podman run -d -v /myvol2 --name c2 $IMAGE top
|
||||
c1=c1-$(safename)
|
||||
c2=c2-$(safename)
|
||||
run_podman run -v /myvol1 --name $c1 $IMAGE true
|
||||
run_podman run -d -v /myvol2 --name $c2 $IMAGE top
|
||||
|
||||
run_podman system df --format '{{ .Type }}:{{ .Total }}:{{ .Active }}'
|
||||
is "${lines[0]}" "Images:1:1" "system df : Images line"
|
||||
@ -111,10 +112,10 @@ Size | ~${size}.*MB | !0B | 0B
|
||||
|
||||
# Containers are listed in random order. Just check that each has 1 volume
|
||||
is "${lines[5]}" \
|
||||
"[0-9a-f]\{12\} *[0-9a-f]\{12\} .* 1 .* c[12]" \
|
||||
"[0-9a-f]\{12\} *[0-9a-f]\{12\} .* 1 .* c[12]-$(safename)" \
|
||||
"system df -v, 'Containers', first line"
|
||||
is "${lines[6]}" \
|
||||
"[0-9a-f]\{12\} *[0-9a-f]\{12\} .* 1 .* c[12]" \
|
||||
"[0-9a-f]\{12\} *[0-9a-f]\{12\} .* 1 .* c[12]-$(safename)" \
|
||||
"system df -v, 'Containers', second line"
|
||||
|
||||
# Volumes, likewise: random order.
|
||||
@ -134,10 +135,10 @@ Size | ~${size}.*MB | !0B | 0B
|
||||
run_podman system df --format '{{.Reclaimable}}'
|
||||
is "${lines[0]}" "0B (0%)" "cannot reclaim image data as it's still used by the containers"
|
||||
|
||||
run_podman stop c2
|
||||
run_podman stop $c2
|
||||
|
||||
# Create a second image by committing a container.
|
||||
run_podman container commit -q c1
|
||||
run_podman container commit -q $c1
|
||||
image="$output"
|
||||
|
||||
run_podman system df --format '{{.Reclaimable}}'
|
||||
@ -149,7 +150,7 @@ Size | ~${size}.*MB | !0B | 0B
|
||||
run_podman system df -v
|
||||
is "$output" ".*0B\\s\\+2.*"
|
||||
|
||||
run_podman rm c1 c2
|
||||
run_podman rm $c1 $c2
|
||||
|
||||
run_podman system df --format '{{.Reclaimable}}'
|
||||
is "${lines[0]}" ".* (100%)" "100 percent of image data is reclaimable because all containers are gone"
|
||||
|
Reference in New Issue
Block a user