From 0da40545347e6a607fe944a264eabef62dcc5f8e Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 17 Jan 2024 16:03:35 -0500 Subject: [PATCH] Verify the empty mounts.conf does not generate warnings. Signed-off-by: Daniel J Walsh --- test/system/030-run.bats | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 2148d3f17f..a5f4e46a19 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -1403,6 +1403,30 @@ search | $IMAGE | run_podman rm -f -t0 $cid } +@test "podman run with mounts.conf missing" { + skip_if_remote "--default-mounts-file is not supported for remote clients" + MOUNTS_CONF=$PODMAN_TMPDIR/mounts.conf + run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE echo test1 + assert "$output" = "test1" "No warning messages on missing mounts file" + + touch ${MOUNTS_CONF} + + run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE echo test2 + assert "$output" = "test2" "No warning messages on empty mounts file" + + echo /tmp/bogus > ${MOUNTS_CONF} + run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE echo test3 + assert "$output" = "test3" "No warning messages on missing content in mounts file" + + randfile=$(random_string 30) + randcontent=$(random_string 30) + mkdir -p $PODMAN_TMPDIR/mounts + echo $randcontent > $PODMAN_TMPDIR/mounts/$randfile + echo $PODMAN_TMPDIR/mounts:/run/secrets > ${MOUNTS_CONF} + run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE cat /run/secrets/$randfile + assert "$output" = "$randcontent" "mounts should appear in container" +} + @test "podman run - rm pod if container creation failed with -pod new:" { run_podman run -d --name foobar $IMAGE hostname cid=$output