1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

fix docker integration-cli restart test race

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
This commit is contained in:
Erik Hollensbe 2014-07-28 23:46:14 -07:00
parent ac3eecf3db
commit 5931669343

View file

@ -4,6 +4,7 @@ import (
"os/exec" "os/exec"
"strings" "strings"
"testing" "testing"
"time"
) )
func TestDockerRestartStoppedContainer(t *testing.T) { func TestDockerRestartStoppedContainer(t *testing.T) {
@ -49,6 +50,8 @@ func TestDockerRestartRunningContainer(t *testing.T) {
cleanedContainerID := stripTrailingCharacters(out) cleanedContainerID := stripTrailingCharacters(out)
time.Sleep(1 * time.Second)
runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID) runCmd = exec.Command(dockerBinary, "logs", cleanedContainerID)
out, _, err = runCommandWithOutput(runCmd) out, _, err = runCommandWithOutput(runCmd)
errorOut(err, t, out) errorOut(err, t, out)
@ -65,6 +68,8 @@ func TestDockerRestartRunningContainer(t *testing.T) {
out, _, err = runCommandWithOutput(runCmd) out, _, err = runCommandWithOutput(runCmd)
errorOut(err, t, out) errorOut(err, t, out)
time.Sleep(1 * time.Second)
if out != "foobar\nfoobar\n" { if out != "foobar\nfoobar\n" {
t.Errorf("container should've printed 'foobar' twice") t.Errorf("container should've printed 'foobar' twice")
} }