Commit 04a3a744 authored by Dmitry Vyukov's avatar Dmitry Vyukov

net/http/fcgi: fix test

Currently the test fails if run more than once:

$ go test -v -run=TestChildServeCleansUp -cpu=1,1 net/http/fcgi
=== RUN TestChildServeCleansUp
--- PASS: TestChildServeCleansUp (0.00s)
=== RUN TestChildServeCleansUp
fatal error: all goroutines are asleep - deadlock!

The problem is that the writer mutates test input data,
so it is wrong on the second execution.

Change-Id: I4ca54dd2926c6986b2908023ac65e5e65630ed26
Reviewed-on: https://go-review.googlesource.com/6383Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent dd82d5e7
......@@ -233,7 +233,9 @@ func (nopWriteCloser) Close() error {
// isn't met. See issue 6934.
func TestChildServeCleansUp(t *testing.T) {
for _, tt := range cleanUpTests {
rc := nopWriteCloser{bytes.NewBuffer(tt.input)}
input := make([]byte, len(tt.input))
copy(input, tt.input)
rc := nopWriteCloser{bytes.NewBuffer(input)}
done := make(chan bool)
c := newChild(rc, http.HandlerFunc(func(
w http.ResponseWriter,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment