diff options
author | Chris Evich <cevich@redhat.com> | 2021-10-14 14:32:20 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-10-19 15:56:35 -0400 |
commit | 7923bfcb0dcf645cf4c53124c87eaa933b7bd30c (patch) | |
tree | 4f47a31a3e2e96aa18656a074eb5be07ec474602 | |
parent | c135ff76d2665b48133c6813d0302e12939d4d9e (diff) | |
download | podman-7923bfcb0dcf645cf4c53124c87eaa933b7bd30c.tar.gz podman-7923bfcb0dcf645cf4c53124c87eaa933b7bd30c.tar.bz2 podman-7923bfcb0dcf645cf4c53124c87eaa933b7bd30c.zip |
Test-hang fix: Wait for ready + timeout on connect.
It was observed during initial F35 testing, this test can cause Ginkgo
to "hang" by attempting to connect before the redis is up/listening.
Fix this by confirming the ready-state before attempting to connect.
Also, force IPv4 and timeout on any connection fault - to allow other
tests to run.
Thanks to Adrian Reber for help on this and related fixes.
Signed-off-by: Chris Evich <cevich@redhat.com>
-rw-r--r-- | test/e2e/checkpoint_test.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index 403d739f0..e88198f53 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -6,6 +6,7 @@ import ( "os" "os/exec" "strings" + "time" "github.com/containers/podman/v3/pkg/checkpoint/crutils" "github.com/containers/podman/v3/pkg/criu" @@ -247,16 +248,19 @@ var _ = Describe("Podman checkpoint", func() { session := podmanTest.Podman(localRunString) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) + cid := session.OutputToString() + if !WaitContainerReady(podmanTest, cid, "Ready to accept connections", 20, 1) { + Fail("Container failed to get ready") + } IP := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"}) IP.WaitWithDefaultTimeout() Expect(IP).Should(Exit(0)) // Open a network connection to the redis server - conn, err := net.Dial("tcp", IP.OutputToString()+":6379") - if err != nil { - os.Exit(1) - } + conn, err := net.DialTimeout("tcp4", IP.OutputToString()+":6379", time.Duration(3)*time.Second) + Expect(err).To(BeNil()) + // This should fail as the container has established TCP connections result := podmanTest.Podman([]string{"container", "checkpoint", "-l"}) result.WaitWithDefaultTimeout() |