summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiqiao Pu <ypu@redhat.com>2018-04-23 17:17:58 +0800
committerYiqiao Pu <ypu@redhat.com>2018-04-23 17:34:21 +0800
commit18c98375a08543d30b0371b8947aac347fc2e1c4 (patch)
tree6991ed6d6ce4f69131ac2802f938a279394e394c
parent3a220be5bb3d7100c9b69eee4986c44f9f636873 (diff)
downloadpodman-18c98375a08543d30b0371b8947aac347fc2e1c4.tar.gz
podman-18c98375a08543d30b0371b8947aac347fc2e1c4.tar.bz2
podman-18c98375a08543d30b0371b8947aac347fc2e1c4.zip
Improve restart latest container test
Remove the --latest from the restart running container test, and add a separated case with following steps: start two container in order: test1, test2 restart container with --latest check the start time for test1 and test2 And the results should be test1 is not restarted and test2 is restarted. Signed-off-by: Yiqiao Pu <ypu@redhat.com>
-rw-r--r--test/e2e/restart_test.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index cae775cc1..46f950dd2 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -74,7 +74,7 @@ var _ = Describe("Podman restart", func() {
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
startTime.WaitWithDefaultTimeout()
- session := podmanTest.Podman([]string{"restart", "--latest"})
+ session := podmanTest.Podman([]string{"restart", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
@@ -99,4 +99,23 @@ var _ = Describe("Podman restart", func() {
Expect(restartTime.OutputToStringArray()[0]).To(Not(Equal(startTime.OutputToStringArray()[0])))
Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
})
+
+ It("Podman restart the latest container", func() {
+ _, exitCode, _ := podmanTest.RunLsContainer("test1")
+ Expect(exitCode).To(Equal(0))
+
+ _, exitCode, _ = podmanTest.RunLsContainer("test2")
+ Expect(exitCode).To(Equal(0))
+
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ startTime.WaitWithDefaultTimeout()
+
+ session := podmanTest.Podman([]string{"restart", "-l"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToStringArray()[0]).To(Equal(startTime.OutputToStringArray()[0]))
+ Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
+ })
})