From 6f1440a3ec16dfbf644acb87012967bc297ec975 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 8 Jun 2020 15:15:16 -0400 Subject: Add support for the unless-stopped restart policy We initially believed that implementing this required support for restarting containers after reboot, but this is not the case. The unless-stopped restart policy acts identically to the always restart policy except in cases related to reboot (which we do not support yet), but it does not require that support for us to implement it. Changes themselves are quite simple, we need a new restart policy constant, we need to remove existing checks that block creation of containers when unless-stopped was used, and we need to update the manpages. Fixes #6508 Signed-off-by: Matthew Heon --- test/e2e/create_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 822e470f2..52ce0b46a 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -401,6 +401,20 @@ var _ = Describe("Podman create", func() { Expect(session.ExitCode()).To(Not(Equal(0))) }) + It("podman create with --restart-policy unless-stopped", func() { + ctrName := "testctr" + unlessStopped := "unless-stopped" + session := podmanTest.Podman([]string{"create", "-t", "--restart", unlessStopped, "--name", ctrName, ALPINE, "/bin/sh"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"inspect", ctrName}) + inspect.WaitWithDefaultTimeout() + data := inspect.InspectContainerToJSON() + Expect(len(data)).To(Equal(1)) + Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal(unlessStopped)) + }) + It("podman create with -m 1000000 sets swap to 2000000", func() { numMem := 1000000 ctrName := "testCtr" -- cgit v1.2.3-54-g00ecf