chore: fix flaky TestCacheGetNoDate race (#31687)
This commit is contained in:
parent
cc0b5acafb
commit
8f570f84c1
1 changed files with 3 additions and 1 deletions
|
|
@ -31,9 +31,11 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
panic(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
// increment before flushing: the client returns as soon as it reads the body,
|
||||
// so counting after the flush races with the test asserting on cnt
|
||||
h.cnt++
|
||||
fmt.Fprintf(buf, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Length: %d\r\n\r\n%s", len(h.val), h.val)
|
||||
buf.Flush()
|
||||
h.cnt++
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue