Skip to content

Commit 11c37d5

Browse files
Merge pull request #21272 from rhatdan/VENDOR
Add tests to make sure mounts.conf does not warn on missing content
2 parents 5e64d4f + 0da4054 commit 11c37d5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/system/030-run.bats

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,30 @@ search | $IMAGE |
14031403
run_podman rm -f -t0 $cid
14041404
}
14051405

1406+
@test "podman run with mounts.conf missing" {
1407+
skip_if_remote "--default-mounts-file is not supported for remote clients"
1408+
MOUNTS_CONF=$PODMAN_TMPDIR/mounts.conf
1409+
run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE echo test1
1410+
assert "$output" = "test1" "No warning messages on missing mounts file"
1411+
1412+
touch ${MOUNTS_CONF}
1413+
1414+
run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE echo test2
1415+
assert "$output" = "test2" "No warning messages on empty mounts file"
1416+
1417+
echo /tmp/bogus > ${MOUNTS_CONF}
1418+
run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE echo test3
1419+
assert "$output" = "test3" "No warning messages on missing content in mounts file"
1420+
1421+
randfile=$(random_string 30)
1422+
randcontent=$(random_string 30)
1423+
mkdir -p $PODMAN_TMPDIR/mounts
1424+
echo $randcontent > $PODMAN_TMPDIR/mounts/$randfile
1425+
echo $PODMAN_TMPDIR/mounts:/run/secrets > ${MOUNTS_CONF}
1426+
run_podman run --rm --default-mounts-file=${MOUNTS_CONF} $IMAGE cat /run/secrets/$randfile
1427+
assert "$output" = "$randcontent" "mounts should appear in container"
1428+
}
1429+
14061430
@test "podman run - rm pod if container creation failed with -pod new:" {
14071431
run_podman run -d --name foobar $IMAGE hostname
14081432
cid=$output

0 commit comments

Comments
 (0)