Skip to content

Commit

Permalink
Merge pull request #40 from vinxi/bugfix/race_condition
Browse files Browse the repository at this point in the history
fix(test): fix race conditions in Forward tests
  • Loading branch information
h2non committed Jun 2, 2016
2 parents df44e02 + c46aadd commit 4ad0b04
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions forward/forward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,11 @@ func (s *FwdSuite) TestCustomRewriter(c *C) {
}

func (s *FwdSuite) TestCustomTransportTimeout(c *C) {
done := make(chan bool)
srv := testutils.NewHandler(func(w http.ResponseWriter, req *http.Request) {
time.Sleep(20 * time.Millisecond)
w.Write([]byte("hello"))
done <- true
})
defer srv.Close()

Expand All @@ -179,6 +181,7 @@ func (s *FwdSuite) TestCustomTransportTimeout(c *C) {
defer proxy.Close()

re, _, err := testutils.Get(proxy.URL)
<-done
c.Assert(err, IsNil)
c.Assert(re.StatusCode, Equals, http.StatusGatewayTimeout)
}
Expand Down

0 comments on commit 4ad0b04

Please sign in to comment.