Skip to content

Commit

Permalink
Wait for context finalization to provoke http timeouts on tests (#8074)…
Browse files Browse the repository at this point in the history
… (#8128)

Wait for request context to be done, that is closed when the server is
stopped.

(cherry picked from commit 81270a5)
  • Loading branch information
jsoriano authored Aug 29, 2018
1 parent 3555b29 commit 8de038e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion metricbeat/module/apache/status/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestFetchTimeout(t *testing.T) {
w.WriteHeader(200)
w.Header().Set("Content-Type", "text/plain; charset=ISO-8859-1")
w.Write([]byte(response))
time.Sleep(100 * time.Millisecond)
<-r.Context().Done()
}))
defer server.Close()

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/envoyproxy/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestFetchTimeout(t *testing.T) {
w.WriteHeader(200)
w.Header().Set("Content-Type", "text/plain; charset=UTF-8")
w.Write([]byte(response))
time.Sleep(100 * time.Millisecond)
<-r.Context().Done()
}))
defer server.Close()

Expand Down

0 comments on commit 8de038e

Please sign in to comment.