mirror of
https://github.com/containers/podman.git
synced 2025-06-27 05:26:50 +08:00
Merge pull request #11979 from cevich/more_criu_fix
Test-hang fix: Wait for ready + timeout on connect.
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/containers/podman/v3/pkg/checkpoint/crutils"
|
"github.com/containers/podman/v3/pkg/checkpoint/crutils"
|
||||||
"github.com/containers/podman/v3/pkg/criu"
|
"github.com/containers/podman/v3/pkg/criu"
|
||||||
@ -247,16 +248,19 @@ var _ = Describe("Podman checkpoint", func() {
|
|||||||
session := podmanTest.Podman(localRunString)
|
session := podmanTest.Podman(localRunString)
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
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 := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"})
|
||||||
IP.WaitWithDefaultTimeout()
|
IP.WaitWithDefaultTimeout()
|
||||||
Expect(IP).Should(Exit(0))
|
Expect(IP).Should(Exit(0))
|
||||||
|
|
||||||
// Open a network connection to the redis server
|
// Open a network connection to the redis server
|
||||||
conn, err := net.Dial("tcp", IP.OutputToString()+":6379")
|
conn, err := net.DialTimeout("tcp4", IP.OutputToString()+":6379", time.Duration(3)*time.Second)
|
||||||
if err != nil {
|
Expect(err).To(BeNil())
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
// This should fail as the container has established TCP connections
|
// This should fail as the container has established TCP connections
|
||||||
result := podmanTest.Podman([]string{"container", "checkpoint", "-l"})
|
result := podmanTest.Podman([]string{"container", "checkpoint", "-l"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
|
Reference in New Issue
Block a user