Add --no-hostname option

Fixes: https://github.com/containers/podman/issues/25002

Also add the ability to inspect containers for
UseImageHosts and UseImageHostname.

Finally fixed some bugs in handling of --no-hosts for Pods,
which I descovered.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2025-01-13 12:05:25 -05:00
parent 04e6488315
commit 6565bde6e8
35 changed files with 160 additions and 21 deletions

View File

@@ -123,6 +123,22 @@ var _ = Describe("Podman pod create", func() {
Expect(podResolvConf.OutputToString()).To(Equal(alpineResolvConf.OutputToString()))
})
It("podman create pod with --no-hostname", func() {
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--no-hostname", "--name", name})
podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(ExitCleanly())
alpineHostname := podmanTest.Podman([]string{"run", "--rm", "--no-hostname", ALPINE, "cat", "/etc/hostname"})
alpineHostname.WaitWithDefaultTimeout()
Expect(alpineHostname).Should(ExitCleanly())
podHostname := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "cat", "/etc/hostname"})
podHostname.WaitWithDefaultTimeout()
Expect(podHostname).Should(ExitCleanly())
Expect(podHostname.OutputToString()).To(Equal(alpineHostname.OutputToString()))
})
It("podman create pod with --no-hosts and no infra should fail", func() {
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--no-hosts", "--name", name, "--infra=false"})