Skip to content

Commit 3b61e56

Browse files
committed
test/system: Use correct device for I/O limit tests
The tests were incorrectly using `/dev/zero`. These options are intended to set I/O limits on specific block devices. The test already sets up a loopback device, so reuse it. Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent f6b91d7 commit 3b61e56

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

test/system/030-run.bats

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,18 +1123,24 @@ EOF
11231123
@test "podman run --device-read-bps" {
11241124
skip_if_rootless "cannot use this flag in rootless mode"
11251125

1126+
if test \! -e /dev/nullb0; then
1127+
skip "/dev/nullb0 not present, use 'modprobe null_blk nr_devices=1' to create it"
1128+
fi
1129+
11261130
local cid
1131+
local dev_maj_min=$(stat -c %Hr:%Lr /dev/nullb0)
1132+
11271133
# this test is a triple check on blkio flags since they seem to sneak by the tests
11281134
if is_cgroupsv2; then
1129-
run_podman run -dt --device-read-bps=/dev/zero:1M $IMAGE top
1135+
run_podman run -dt --device-read-bps=/dev/nullb0:1M $IMAGE top
11301136
cid=$output
11311137
run_podman exec -it $output cat /sys/fs/cgroup/io.max
1132-
is "$output" ".*1:5 rbps=1048576 wbps=max riops=max wiops=max" "throttle devices passed successfully.*"
1138+
is "$output" ".*$dev_maj_min rbps=1048576 wbps=max riops=max wiops=max" "throttle devices passed successfully.*"
11331139
else
1134-
run_podman run -dt --device-read-bps=/dev/zero:1M $IMAGE top
1140+
run_podman run -dt --device-read-bps=/dev/nullb0:1M $IMAGE top
11351141
cid=$output
11361142
run_podman exec -it $output cat /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device
1137-
is "$output" ".*1:5 1048576" "throttle devices passed successfully.*"
1143+
is "$output" ".*$dev_maj_min 1048576" "throttle devices passed successfully.*"
11381144
fi
11391145
run_podman container rm -f -t0 $cid
11401146
}

test/system/280-update.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ memory-reservation = 400M | 2 | $mm.soft_limit_in_bytes = 419430400
6363
blkio-weight = 321 | - | - | io.bfq.weight = default 321 $lomajmin 98
6464
blkio-weight-device = $LOOPDEVICE:98 | - | - | io.bfq.weight = default 321 $lomajmin 98
6565
66-
device-read-bps = /dev/zero:10mb | - | - | io.max = $devicemax
67-
device-read-iops = /dev/zero:2000 | - | - | io.max = $devicemax
68-
device-write-bps = /dev/zero:30mb | - | - | io.max = $devicemax
69-
device-write-iops = /dev/zero:4000 | - | - | io.max = $devicemax
66+
device-read-bps = $LOOPDEVICE:10mb | - | - | io.max = $devicemax
67+
device-read-iops = $LOOPDEVICE:2000 | - | - | io.max = $devicemax
68+
device-write-bps = $LOOPDEVICE:30mb | - | - | io.max = $devicemax
69+
device-write-iops = $LOOPDEVICE:4000 | - | - | io.max = $devicemax
7070
"
7171

7272
# Run a container

0 commit comments

Comments
 (0)