Skip to content

Commit

Permalink
Merge pull request #23916 from edsantiago/safename-320
Browse files Browse the repository at this point in the history
CI: mark 320-system-df *NOT* parallel safe
  • Loading branch information
openshift-merge-bot[bot] authored Sep 13, 2024
2 parents 4a757d4 + 0ff89a0 commit 29f7500
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions test/system/320-system-df.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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"

Expand Down Expand Up @@ -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"
Expand All @@ -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.
Expand All @@ -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}}'
Expand All @@ -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"
Expand Down

1 comment on commit 29f7500

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.