File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,10 @@ func (d *dfContainer) ContainerID() string {
275
275
}
276
276
277
277
func (d * dfContainer ) Image () string {
278
- return d .SystemDfContainerReport .Image [0 :12 ]
278
+ if len (d .SystemDfContainerReport .Image ) >= 12 {
279
+ return d .SystemDfContainerReport .Image [0 :12 ]
280
+ }
281
+ return ""
279
282
}
280
283
281
284
func (d * dfContainer ) Command () string {
Original file line number Diff line number Diff line change @@ -34,6 +34,23 @@ function setup_file() {
34
34
is " $output " ' .*"Local Volumes".*"Size":"0B"' " Total containers reported"
35
35
}
36
36
37
+ # Regression test for https://github.com/containers/podman/issues/26224
38
+ @test " podman system df - with rootfs container" {
39
+ pod=p-$( safename)
40
+ # create a pod which creates an infra container based on a rootfs
41
+ run_podman pod create --name $pod
42
+
43
+ run_podman system df
44
+ assert " ${lines[1]} " =~ " Images *1 *0.*"
45
+ assert " ${lines[2]} " =~ " Containers *1 *0.*"
46
+ run_podman system df --verbose
47
+ assert " ${lines[5]} " =~ \
48
+ " [0-9a-f]{12} *0.*[0-9a-f]{12}-infra" \
49
+ " system df --verbose, 'Containers', infra line"
50
+
51
+ run_podman pod rm -f $pod
52
+ }
53
+
37
54
@test " podman system df --format json functionality" {
38
55
# Run two dummy containers, one which exits, one which stays running
39
56
cname_stopped=c-stopped-$( safename)
You can’t perform that action at this time.
0 commit comments