Verified Commit 1b06b69f authored by Nick Thomas's avatar Nick Thomas 🔴 Committed by Tomasz Maczukin

Fix an intermittent test failure

parent 4b669ccf
......@@ -8,6 +8,7 @@ import (
"os"
"path"
"strings"
"sync"
"testing"
"time"
......@@ -773,11 +774,14 @@ func TestDockerWatchOn_1_12_4(t *testing.T) {
input := bytes.NewBufferString("echo 'script'")
finished := make(chan bool, 1)
wg := &sync.WaitGroup{}
wg.Add(1) // Avoid a race where assert.NoError() is called too late in the goroutine
go func() {
err = e.watchContainer(container, input, abort)
assert.NoError(t, err)
t.Log(err)
finished <- true
wg.Done()
}()
select {
......@@ -788,6 +792,7 @@ func TestDockerWatchOn_1_12_4(t *testing.T) {
err = e.removeContainer(container.ID)
assert.NoError(t, err)
wg.Wait()
}
func init() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment