From 04dbbd96b6f69f65ac809938f44888728119db87 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 21 Dec 2021 10:50:32 +0100 Subject: support hosts without /etc/hosts Fixes: #12667 Signed-off-by: Valentin Rothberg --- test/system/030-run.bats | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/system') diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 6f1fa600a..55514305b 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -756,4 +756,14 @@ EOF is "$output" ".*TERM=abc" "missing TERM environment variable despite TERM being set on commandline" } +@test "podman run - no /etc/hosts" { + skip_if_rootless "cannot move /etc/hosts file as a rootless user" + tmpfile=$PODMAN_TMPDIR/hosts + mv /etc/hosts $tmpfile + run_podman '?' run --rm --add-host "foo.com:1.2.3.4" $IMAGE cat "/etc/hosts" + mv $tmpfile /etc/hosts + is "$status" 0 "podman run without /etc/hosts file should work" + is "$output" "1.2.3.4 foo.com.*" "users can add hosts even without /etc/hosts" +} + # vim: filetype=sh -- cgit v1.2.3-54-g00ecf