From 6e7c91a1cbd011a6e08f96100d797d94e528ab12 Mon Sep 17 00:00:00 2001 From: dlorenc Date: Thu, 17 Jan 2019 15:30:08 -0500 Subject: [PATCH] Deflake the daemon test (#532) There's a race condition here where sometimes we get a layer and othertimes we don't. --- integration/cmd.go | 11 ++--------- integration/dockerfiles/Dockerfile_test_daemons | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/integration/cmd.go b/integration/cmd.go index a254197bf..94f5701cb 100644 --- a/integration/cmd.go +++ b/integration/cmd.go @@ -18,7 +18,6 @@ package integration import ( "bytes" - "fmt" "os/exec" "testing" ) @@ -26,14 +25,8 @@ import ( // RunCommandWithoutTest will run cmd and if it fails will output relevant info // for debugging before returning an error. It can be run outside the context of a test. func RunCommandWithoutTest(cmd *exec.Cmd) ([]byte, error) { - var stderr bytes.Buffer - cmd.Stderr = &stderr - output, err := cmd.Output() - if err != nil { - fmt.Println(cmd.Args) - fmt.Println(stderr.String()) - fmt.Println(string(output)) - } + output, err := cmd.CombinedOutput() + return output, err } diff --git a/integration/dockerfiles/Dockerfile_test_daemons b/integration/dockerfiles/Dockerfile_test_daemons index 134ce92ca..8f942bea9 100644 --- a/integration/dockerfiles/Dockerfile_test_daemons +++ b/integration/dockerfiles/Dockerfile_test_daemons @@ -1,3 +1,3 @@ FROM busybox -RUN while true; do dd if=/dev/zero of=file`date +%s`.txt count=16000 bs=256 > /dev/null 2>&1; done & +RUN (while true; do sleep 10; dd if=/dev/zero of=file`date +%s`.txt count=16000 bs=256 > /dev/null 2>&1; done &); sleep 1 RUN echo "wait a second..." && sleep 2 && ls -lrat file*.txt || echo "test passed."