mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
e2e: ExitCleanly(): low-hanging fruit, part 1
Continuing work on RUN-1907: huge set of files, but not as intimidating as it looks. Commit 1 of 2: mindless replace of Exit(0) with ExitCleanly() Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@@ -49,7 +49,7 @@ var _ = Describe("Podman pause", func() {
|
||||
It("podman pause a created container by id", func() {
|
||||
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", cid})
|
||||
@@ -62,18 +62,18 @@ var _ = Describe("Podman pause", func() {
|
||||
// check we can read stats for a paused container
|
||||
result = podmanTest.Podman([]string{"stats", "--no-stream", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman pause a running container by id", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
result := podmanTest.Podman([]string{"pause", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
|
||||
|
||||
@@ -84,13 +84,13 @@ var _ = Describe("Podman pause", func() {
|
||||
It("podman container pause a running container by id", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
|
||||
result := podmanTest.Podman([]string{"container", "pause", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
|
||||
|
||||
@@ -101,7 +101,7 @@ var _ = Describe("Podman pause", func() {
|
||||
It("podman unpause a running container by id", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
|
||||
result := podmanTest.Podman([]string{"unpause", cid})
|
||||
@@ -115,13 +115,13 @@ var _ = Describe("Podman pause", func() {
|
||||
It("podman remove a paused container by id without force", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
|
||||
|
||||
@@ -136,39 +136,39 @@ var _ = Describe("Podman pause", func() {
|
||||
// otherwise it fails with container state improper
|
||||
session = podmanTest.Podman([]string{"unpause", cid})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman remove a paused container by id with force", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
|
||||
|
||||
result = podmanTest.Podman([]string{"rm", "-t", "0", "--force", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman stop a paused container by id", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToString()
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
|
||||
|
||||
@@ -181,7 +181,7 @@ var _ = Describe("Podman pause", func() {
|
||||
|
||||
result = podmanTest.Podman([]string{"unpause", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||
|
||||
result = podmanTest.Podman([]string{"rm", cid})
|
||||
@@ -191,7 +191,7 @@ var _ = Describe("Podman pause", func() {
|
||||
|
||||
result = podmanTest.Podman([]string{"rm", "-t", "0", "-f", cid})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
|
||||
})
|
||||
@@ -199,12 +199,12 @@ var _ = Describe("Podman pause", func() {
|
||||
It("podman pause a running container by name", func() {
|
||||
session := podmanTest.RunTopContainer("test1")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", "test1"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(Equal(pausedState))
|
||||
|
||||
@@ -215,23 +215,23 @@ var _ = Describe("Podman pause", func() {
|
||||
It("podman pause a running container by id and another by name", func() {
|
||||
session1 := podmanTest.RunTopContainer("test1")
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
|
||||
session2 := podmanTest.RunTopContainer("")
|
||||
session2.WaitWithDefaultTimeout()
|
||||
Expect(session2).Should(Exit(0))
|
||||
Expect(session2).Should(ExitCleanly())
|
||||
cid2 := session2.OutputToString()
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", cid2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||
|
||||
result = podmanTest.Podman([]string{"pause", "test1"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
|
||||
result = podmanTest.Podman([]string{"unpause", "test1"})
|
||||
@@ -243,7 +243,7 @@ var _ = Describe("Podman pause", func() {
|
||||
It("Pause all containers (no containers exist)", func() {
|
||||
result := podmanTest.Podman([]string{"pause", "--all"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
|
||||
})
|
||||
@@ -251,7 +251,7 @@ var _ = Describe("Podman pause", func() {
|
||||
It("Unpause all containers (no paused containers exist)", func() {
|
||||
result := podmanTest.Podman([]string{"unpause", "--all"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
|
||||
@@ -260,26 +260,26 @@ var _ = Describe("Podman pause", func() {
|
||||
name := fmt.Sprintf("test%d", i)
|
||||
run := podmanTest.Podman([]string{"run", "-dt", "--name", name, NGINX_IMAGE})
|
||||
run.WaitWithDefaultTimeout()
|
||||
Expect(run).Should(Exit(0))
|
||||
Expect(run).Should(ExitCleanly())
|
||||
|
||||
}
|
||||
running := podmanTest.Podman([]string{"ps", "-q"})
|
||||
running.WaitWithDefaultTimeout()
|
||||
Expect(running).Should(Exit(0))
|
||||
Expect(running).Should(ExitCleanly())
|
||||
Expect(running.OutputToStringArray()).To(HaveLen(3))
|
||||
|
||||
pause := podmanTest.Podman([]string{"pause", "--all"})
|
||||
pause.WaitWithDefaultTimeout()
|
||||
Expect(pause).Should(Exit(0))
|
||||
Expect(pause).Should(ExitCleanly())
|
||||
|
||||
running = podmanTest.Podman([]string{"ps", "-q"})
|
||||
running.WaitWithDefaultTimeout()
|
||||
Expect(running).Should(Exit(0))
|
||||
Expect(running).Should(ExitCleanly())
|
||||
Expect(running.OutputToStringArray()).To(BeEmpty())
|
||||
|
||||
unpause := podmanTest.Podman([]string{"unpause", "--all"})
|
||||
unpause.WaitWithDefaultTimeout()
|
||||
Expect(unpause).Should(Exit(0))
|
||||
Expect(unpause).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("Unpause a bunch of running containers", func() {
|
||||
@@ -287,20 +287,20 @@ var _ = Describe("Podman pause", func() {
|
||||
name := fmt.Sprintf("test%d", i)
|
||||
run := podmanTest.Podman([]string{"run", "-dt", "--name", name, NGINX_IMAGE})
|
||||
run.WaitWithDefaultTimeout()
|
||||
Expect(run).Should(Exit(0))
|
||||
Expect(run).Should(ExitCleanly())
|
||||
|
||||
}
|
||||
pause := podmanTest.Podman([]string{"pause", "--all"})
|
||||
pause.WaitWithDefaultTimeout()
|
||||
Expect(pause).Should(Exit(0))
|
||||
Expect(pause).Should(ExitCleanly())
|
||||
|
||||
unpause := podmanTest.Podman([]string{"unpause", "--all"})
|
||||
unpause.WaitWithDefaultTimeout()
|
||||
Expect(unpause).Should(Exit(0))
|
||||
Expect(unpause).Should(ExitCleanly())
|
||||
|
||||
running := podmanTest.Podman([]string{"ps", "-q"})
|
||||
running.WaitWithDefaultTimeout()
|
||||
Expect(running).Should(Exit(0))
|
||||
Expect(running).Should(ExitCleanly())
|
||||
Expect(running.OutputToStringArray()).To(HaveLen(3))
|
||||
})
|
||||
|
||||
@@ -308,11 +308,11 @@ var _ = Describe("Podman pause", func() {
|
||||
SkipIfRemote("--latest flag n/a")
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
result := podmanTest.Podman([]string{"pause", "-l"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
|
||||
|
||||
@@ -326,22 +326,22 @@ var _ = Describe("Podman pause", func() {
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToStringArray()[0]
|
||||
|
||||
session = podmanTest.Podman([]string{"start", cid})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", "--cidfile", tmpFile})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
Expect(output).To(ContainSubstring(cid))
|
||||
|
||||
result = podmanTest.Podman([]string{"unpause", "--cidfile", tmpFile})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output = result.OutputToString()
|
||||
Expect(output).To(ContainSubstring(cid))
|
||||
})
|
||||
@@ -355,19 +355,19 @@ var _ = Describe("Podman pause", func() {
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", tmpFile1, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid1 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--cidfile", tmpFile2, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid2 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
Expect(output).To(ContainSubstring(cid1))
|
||||
Expect(output).To(ContainSubstring(cid2))
|
||||
@@ -375,7 +375,7 @@ var _ = Describe("Podman pause", func() {
|
||||
|
||||
result = podmanTest.Podman([]string{"unpause", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output = result.OutputToString()
|
||||
Expect(output).To(ContainSubstring(cid1))
|
||||
Expect(output).To(ContainSubstring(cid2))
|
||||
@@ -425,17 +425,17 @@ var _ = Describe("Podman pause", func() {
|
||||
It("podman pause --filter", func() {
|
||||
session1 := podmanTest.RunTopContainer("")
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
cid1 := session1.OutputToString()
|
||||
|
||||
session1 = podmanTest.RunTopContainer("")
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
cid2 := session1.OutputToString()
|
||||
|
||||
session1 = podmanTest.RunTopContainerWithArgs("", []string{"--label", "test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
cid3 := session1.OutputToString()
|
||||
shortCid3 := cid3[0:5]
|
||||
|
||||
@@ -449,42 +449,42 @@ var _ = Describe("Podman pause", func() {
|
||||
|
||||
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEmpty())
|
||||
|
||||
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEmpty())
|
||||
|
||||
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"pause", "-f", fmt.Sprintf("id=%s", cid2)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid2))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"unpause", "-f", fmt.Sprintf("id=%s", cid2)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1).Should(ExitCleanly())
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid2))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user