Fix a race in cmd/dockerd/hack.TestHeaderOverrideHack

Fix #22940

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2016-05-24 11:28:50 +00:00
parent f18224de14
commit 1670914b8a

View file

@ -38,9 +38,9 @@ func TestHeaderOverrideHack(t *testing.T) {
read := make([]byte, 4096)
for _, pair := range tests {
go func() {
srv.Write(pair[0])
}()
go func(x []byte) {
srv.Write(x)
}(pair[0])
n, err := l.Read(read)
if err != nil && err != io.EOF {
t.Fatalf("read: %d - %d, err: %v\n%s", n, len(pair[0]), err, string(read[:n]))