From 4f3c6910870af974f8cabe0af0c6cc38e1e6da2f Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 28 May 2024 11:38:02 +0200 Subject: [PATCH] test/system: speed up read-only from containers.conf Instead of iterating over all tmp dirs and creating test containers for each one we can just pass all files to one touch call. With that we have to create much less containers while still checking the same thing. This speeds up the test by about 4 seconds. Signed-off-by: Paul Holzinger --- test/system/030-run.bats | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 823bd7d6ba..5ff1fb29ba 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -1140,16 +1140,19 @@ EOF CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman 1 run --rm $IMAGE touch /testro CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false $IMAGE touch /testrw - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm $IMAGE touch /tmp/testrw - for dir in /tmp /var/tmp /dev /dev/shm /run; do - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false --read-only-tmpfs=true $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only-tmpfs=true $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman 1 run --rm --read-only-tmpfs=false $IMAGE touch $dir/testro - assert "$output" =~ "touch: $dir/testro: Read-only file system" - done + files="/tmp/a /var/tmp/b /dev/c /dev/shm/d /run/e" + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm $IMAGE touch $files + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false $IMAGE touch $files + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false --read-only-tmpfs=true $IMAGE touch $files + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only-tmpfs=true $IMAGE touch $files + + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman 1 run --rm --read-only-tmpfs=false $IMAGE touch $files + assert "$output" == "touch: /tmp/a: Read-only file system +touch: /var/tmp/b: Read-only file system +touch: /dev/c: Read-only file system +touch: /dev/shm/d: Read-only file system +touch: /run/e: Read-only file system" } @test "podman run ulimit from containers.conf" {