diff options
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/010-images.bats | 2 | ||||
-rw-r--r-- | test/system/110-history.bats | 8 | ||||
-rw-r--r-- | test/system/180-blkio.bats | 69 | ||||
-rw-r--r-- | test/system/250-systemd.bats | 11 | ||||
-rw-r--r-- | test/system/255-auto-update.bats | 2 |
5 files changed, 89 insertions, 3 deletions
diff --git a/test/system/010-images.bats b/test/system/010-images.bats index 1e9d5f181..9de31f96c 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -221,9 +221,7 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z iid=${output:0:12} # Run the test: this will output three column-aligned rows. Test them. - # Tab character (\t) should have the same effect as the 'table' directive _run_format_test 'table' 'table {{.Repository}} {{.Tag}} {{.ID}}' - _run_format_test 'tabs' '{{.Repository}}\t{{.Tag}}\t{{.ID}}' # Clean up. run_podman rmi ${aaa_name}:${aaa_tag} ${zzz_name}:${zzz_tag} diff --git a/test/system/110-history.bats b/test/system/110-history.bats index 75c15b088..0f6d75cb3 100644 --- a/test/system/110-history.bats +++ b/test/system/110-history.bats @@ -21,6 +21,14 @@ load helpers done } +@test "podman history - custom format" { + run_podman history --format "{{.ID}}\t{{.ID}}" $IMAGE + od -c <<<$output + while IFS= read -r row; do + is "$row" ".* .*$" + done <<<$output +} + @test "podman history - json" { # Sigh. Timestamp in .created can be '...Z' or '...-06:00' tests=" diff --git a/test/system/180-blkio.bats b/test/system/180-blkio.bats new file mode 100644 index 000000000..68449681a --- /dev/null +++ b/test/system/180-blkio.bats @@ -0,0 +1,69 @@ +#!/usr/bin/env bats -*- bats -*- +# +# podman blkio-related tests +# + +load helpers + +function teardown() { + lofile=${PODMAN_TMPDIR}/disk.img + if [ -f ${lofile} ]; then + run_podman '?' rm -t 0 --all --force + + while read path dev; do + if [[ "$path" == "$lofile" ]]; then + losetup -d $dev + fi + done < <(losetup -l --noheadings --output BACK-FILE,NAME) + + rm ${lofile} + fi + basic_teardown +} + +@test "podman run --blkio-weight-device" { + + skip_if_rootless "cannot create devices in rootless mode" + + # create loopback device + lofile=${PODMAN_TMPDIR}/disk.img + fallocate -l 1k ${lofile} + losetup -f ${lofile} + + run losetup -l --noheadings --output BACK-FILE,NAME,MAJ:MIN + is "$output" ".\+" "Empty output from losetup" + + lodevice=$(awk "\$1 == \"$lofile\" { print \$2 }" <<<"$output") + lomajmin=$(awk "\$1 == \"$lofile\" { print \$3 }" <<<"$output") + + is "$lodevice" ".\+" "Could not determine device for $lofile" + is "$lomajmin" ".\+" "Could not determine major/minor for $lofile" + + # use bfq io scheduler + run grep -w bfq /sys/block/$(basename ${lodevice})/queue/scheduler + if [ $status -ne 0 ]; then + skip "BFQ scheduler is not supported on the system" + fi + echo bfq > /sys/block/$(basename ${lodevice})/queue/scheduler + + # run podman + if is_cgroupsv2; then + if [ ! -f /sys/fs/cgroup/system.slice/io.bfq.weight ]; then + skip "Kernel does not support BFQ IO scheduler" + fi + run_podman run --device ${lodevice}:${lodevice} --blkio-weight-device ${lodevice}:123 --rm $IMAGE \ + /bin/sh -c "cat /sys/fs/cgroup/\$(sed -e 's/0:://' < /proc/self/cgroup)/io.bfq.weight" + is "${lines[1]}" "${lomajmin}\s\+123" + else + if [ ! -f /sys/fs/cgroup/blkio/system.slice/blkio.bfq.weight_device ]; then + skip "Kernel does not support BFQ IO scheduler" + fi + if [ $(podman_runtime) = "crun" ]; then + # As of crun 1.2, crun doesn't support blkio.bfq.weight_device + skip "crun doesn't support blkio.bfq.weight_device" + fi + run_podman run --device ${lodevice}:${lodevice} --blkio-weight-device ${lodevice}:123 --rm $IMAGE \ + /bin/sh -c "cat /sys/fs/cgroup/blkio/blkio.bfq.weight_device" + is "${lines[1]}" "${lomajmin}\s\+123" + fi +} diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats index 4757f7643..56d36934d 100644 --- a/test/system/250-systemd.bats +++ b/test/system/250-systemd.bats @@ -34,6 +34,12 @@ function service_setup() { systemctl daemon-reload + # Also test enabling services (see #12438). + run systemctl enable "$SERVICE_NAME" + if [ $status -ne 0 ]; then + die "Error enabling systemd unit $SERVICE_NAME, output: $output" + fi + run systemctl start "$SERVICE_NAME" if [ $status -ne 0 ]; then die "Error starting systemd unit $SERVICE_NAME, output: $output" @@ -53,6 +59,11 @@ function service_cleanup() { die "Error stopping systemd unit $SERVICE_NAME, output: $output" fi + run systemctl disable "$SERVICE_NAME" + if [ $status -ne 0 ]; then + die "Error disbling systemd unit $SERVICE_NAME, output: $output" + fi + if [[ -z "$status" ]]; then run systemctl is-active "$SERVICE_NAME" if [ $status -ne 0 ]; then diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats index 99211f304..7540270bd 100644 --- a/test/system/255-auto-update.bats +++ b/test/system/255-auto-update.bats @@ -366,7 +366,7 @@ Type=oneshot ExecStart=/usr/bin/podman auto-update [Install] -WantedBy=multi-user.target default.target +WantedBy=default.target EOF echo "podman-auto-update-$cname" >> $SNAME_FILE |