Skip to content

Commit

Permalink
add test to verify hostname is shared in a pod
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hunt <[email protected]>
  • Loading branch information
haircommander committed Aug 6, 2019
1 parent 647fe51 commit b8d36ac
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/e2e/pod_infra_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,24 @@ var _ = Describe("Podman pod create", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})

It("podman run hostname is shared", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
podID := session.OutputToString()

// verify we can add a host to the infra's /etc/hosts
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "hostname"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
hostname := session.OutputToString()

infraName := podID[:12] + "-infra"
// verify we can see the other hosts of infra's /etc/hosts
session = podmanTest.Podman([]string{"inspect", infraName})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring(hostname))
})
})

0 comments on commit b8d36ac

Please sign in to comment.