summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-13 09:58:09 -0500
committerGitHub <noreply@github.com>2021-01-13 09:58:09 -0500
commit99c5746150799d6cfe3ea612d3c88c6b904f9312 (patch)
treefe856f549b38f0ca55f7c2dd8b8640e4b0a22214 /test/e2e
parent183f443a585a3659d807ee413e5b708d37a72924 (diff)
parent0cff5ad0a30cf7de1d4c23ca56a5670c7e2f1192 (diff)
downloadpodman-99c5746150799d6cfe3ea612d3c88c6b904f9312.tar.gz
podman-99c5746150799d6cfe3ea612d3c88c6b904f9312.tar.bz2
podman-99c5746150799d6cfe3ea612d3c88c6b904f9312.zip
Merge pull request #8958 from zhangguanzhang/duplicated-hosts
Fixes /etc/hosts duplicated every time after container restarted in a pod
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/restart_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index 114bd481a..584ccd22b 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -196,4 +196,33 @@ var _ = Describe("Podman restart", func() {
Expect(restartTime.OutputToStringArray()[0]).To(Equal(startTime.OutputToStringArray()[0]))
Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
})
+
+ It("Podman restart a container in a pod and hosts shouln't duplicated", func() {
+ // Fixes: https://github.com/containers/podman/issues/8921
+
+ _, ec, _ := podmanTest.CreatePod("foobar99")
+ Expect(ec).To(Equal(0))
+
+ session := podmanTest.RunTopContainerInPod("host-restart-test", "foobar99")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ testCmd := []string{"exec", "host-restart-test", "sh", "-c", "wc -l < /etc/hosts"}
+
+ // before restart
+ beforeRestart := podmanTest.Podman(testCmd)
+ beforeRestart.WaitWithDefaultTimeout()
+ Expect(beforeRestart.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"restart", "host-restart-test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ afterRestart := podmanTest.Podman(testCmd)
+ afterRestart.WaitWithDefaultTimeout()
+ Expect(afterRestart.ExitCode()).To(Equal(0))
+
+ // line count should be equal
+ Expect(beforeRestart.OutputToString()).To(Equal(afterRestart.OutputToString()))
+ })
})