From 0ff89a00af4171eceb442b92576a004a924633da Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 10 Sep 2024 08:48:44 -0600 Subject: [PATCH] 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 --- test/system/320-system-df.bats | 47 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/test/system/320-system-df.bats b/test/system/320-system-df.bats index 96219074b3..0d5149765b 100644 --- a/test/system/320-system-df.bats +++ b/test/system/320-system-df.bats @@ -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"