Skip to content

Commit

Permalink
Merge pull request #19882 from edsantiago/e2e_exitcleanly
Browse files Browse the repository at this point in the history
e2e: use ExitCleanly() in attach & build tests
  • Loading branch information
openshift-merge-robot committed Sep 7, 2023
2 parents 24e9e94 + 465150f commit c17c190
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 103 deletions.
29 changes: 15 additions & 14 deletions test/e2e/attach_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"syscall"
"time"

. "github.com/containers/podman/v4/test/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
Expand All @@ -18,20 +19,20 @@ var _ = Describe("Podman attach", func() {
})

It("podman attach to non-running container", func() {
session := podmanTest.Podman([]string{"create", "--name", "test1", "-i", ALPINE, "ls"})
session := podmanTest.Podman([]string{"create", "--name", "test1", "-i", CITEST_IMAGE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

results := podmanTest.Podman([]string{"attach", "test1"})
results.WaitWithDefaultTimeout()
Expect(results).Should(Exit(125))
})

It("podman container attach to non-running container", func() {
session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-i", ALPINE, "ls"})
session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-i", CITEST_IMAGE, "ls"})

session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

results := podmanTest.Podman([]string{"container", "attach", "test1"})
results.WaitWithDefaultTimeout()
Expand All @@ -41,21 +42,21 @@ var _ = Describe("Podman attach", func() {
It("podman attach to multiple containers", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

session = podmanTest.RunTopContainer("test2")
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

results := podmanTest.Podman([]string{"attach", "test1", "test2"})
results.WaitWithDefaultTimeout()
Expect(results).Should(Exit(125))
})

It("podman attach to a running container", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test", ALPINE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
session := podmanTest.Podman([]string{"run", "-d", "--name", "test", CITEST_IMAGE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

results := podmanTest.Podman([]string{"attach", "test"})
time.Sleep(2 * time.Second)
Expand All @@ -65,13 +66,13 @@ var _ = Describe("Podman attach", func() {
})

It("podman attach to the latest container", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", ALPINE, "/bin/sh", "-c", "while true; do echo test1; sleep 1; done"})
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", CITEST_IMAGE, "/bin/sh", "-c", "while true; do echo test1; sleep 1; done"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

session = podmanTest.Podman([]string{"run", "-d", "--name", "test2", ALPINE, "/bin/sh", "-c", "while true; do echo test2; sleep 1; done"})
session = podmanTest.Podman([]string{"run", "-d", "--name", "test2", CITEST_IMAGE, "/bin/sh", "-c", "while true; do echo test2; sleep 1; done"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

cid := "-l"
if IsRemote() {
Expand All @@ -85,9 +86,9 @@ var _ = Describe("Podman attach", func() {
})

It("podman attach to a container with --sig-proxy set to false", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test", ALPINE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
session := podmanTest.Podman([]string{"run", "-d", "--name", "test", CITEST_IMAGE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

results := podmanTest.Podman([]string{"attach", "--sig-proxy=false", "test"})
time.Sleep(2 * time.Second)
Expand Down
Loading

0 comments on commit c17c190

Please sign in to comment.