Skip to content

Commit

Permalink
Read response from http.Get() in TestWebInterface, so http.Get() does…
Browse files Browse the repository at this point in the history
… not hang (google#315)

* fix TestWebInterface

* check errors in modified portion of TestWebInterface

* use defer wg.Done()
  • Loading branch information
nolanmar511 authored and lannadorai committed Feb 13, 2018
1 parent b928751 commit 354c28b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/driver/webui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,15 @@ func TestWebInterface(t *testing.T) {
for count := 0; count < 2; count++ {
wg.Add(1)
go func() {
http.Get(path)
wg.Done()
defer wg.Done()
res, err := http.Get(path)
if err != nil {
t.Error("could not fetch", c.path, err)
return
}
if _, err = ioutil.ReadAll(res.Body); err != nil {
t.Error("could not read response", c.path, err)
}
}()
}
}
Expand Down

0 comments on commit 354c28b

Please sign in to comment.