Make sure the container is well started prior to perform the test
This commit is contained in:
parent
73da7a12e7
commit
5a02c9ba0a
1 changed files with 11 additions and 1 deletions
|
@ -273,7 +273,16 @@ func TestAllocatePortLocalhost(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer container.Kill()
|
defer container.Kill()
|
||||||
time.Sleep(600 * time.Millisecond) // Wait for the container to run
|
|
||||||
|
setTimeout(t, "Waiting for the container to be started timed out", 2*time.Second, func() {
|
||||||
|
for {
|
||||||
|
if container.State.Running {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
conn, err := net.Dial("tcp",
|
conn, err := net.Dial("tcp",
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"localhost:%s", container.NetworkSettings.PortMapping["5555"],
|
"localhost:%s", container.NetworkSettings.PortMapping["5555"],
|
||||||
|
@ -293,6 +302,7 @@ func TestAllocatePortLocalhost(t *testing.T) {
|
||||||
string(output),
|
string(output),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
container.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRestore(t *testing.T) {
|
func TestRestore(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue