From 18c98375a08543d30b0371b8947aac347fc2e1c4 Mon Sep 17 00:00:00 2001 From: Yiqiao Pu Date: Mon, 23 Apr 2018 17:17:58 +0800 Subject: 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 --- test/e2e/restart_test.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/e2e') 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]))) + }) }) -- cgit v1.2.3-54-g00ecf