summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-02-26 06:35:39 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-02-26 06:37:48 -0500
commit680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc (patch)
treef9e448591b1562dc7d1f1dffa6dc8bfaf0c21c9b /test/e2e
parent05410e81efec2ef2398f740b81610fbad73b7bf2 (diff)
downloadpodman-680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc.tar.gz
podman-680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc.tar.bz2
podman-680dacaea2c7c8150cb2a8c9770a6e981a1f5ebc.zip
Enable no_hosts from containers.conf
Since we have no good way to enable this on the server side, we will just allow it to be set on the client side. This should solve almost all cases. Partially fixes: https://github.com/containers/podman/issues/9500 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/config/containers.conf1
-rw-r--r--test/e2e/containers_conf_test.go22
2 files changed, 23 insertions, 0 deletions
diff --git a/test/e2e/config/containers.conf b/test/e2e/config/containers.conf
index fdf679664..bbd712254 100644
--- a/test/e2e/config/containers.conf
+++ b/test/e2e/config/containers.conf
@@ -55,6 +55,7 @@ umask = "0002"
annotations=["run.oci.keep_original_groups=1",]
+no_hosts=true
[engine]
network_cmd_options=["allow_host_loopback=true"]
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 9c2260c5f..6b1a0d16e 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -331,4 +331,26 @@ var _ = Describe("Podman run", func() {
Expect(inspect.OutputToString()).To(ContainSubstring("run.oci.keep_original_groups:1"))
})
+ It("podman run with --add-host and no-hosts=true fails", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--add-host", "test1:127.0.0.1", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
+ Expect(session.ErrorToString()).To(ContainSubstring("--no-hosts and --add-host cannot be set together"))
+
+ session = podmanTest.Podman([]string{"run", "-dt", "--add-host", "test1:127.0.0.1", "--no-hosts=false", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman run with no-hosts=true /etc/hosts does not include hostname", func() {
+ session := podmanTest.Podman([]string{"run", "--rm", "--name", "test", ALPINE, "cat", "/etc/hosts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Not(ContainSubstring("test")))
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--name", "test", "--no-hosts=false", ALPINE, "cat", "/etc/hosts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("test"))
+ })
})