Skip to content

Commit c1e8a9a

Browse files
howjmayBryan C. Mills
authored andcommitted
net/http/cgi: Remove hard-coded ServeHTTP timeout
Close #43624 Change-Id: Ifaea3d8ec2aeabbd923abf5edd7497172dbf855a GitHub-Last-Rev: ea3ef95 GitHub-Pull-Request: #43803 Reviewed-on: https://go-review.googlesource.com/c/go/+/284778 Reviewed-by: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> Trust: Robert Findley <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 492eb05 commit c1e8a9a

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

src/net/http/cgi/integration_test.go

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ func (w *limitWriter) Write(p []byte) (n int, err error) {
9595
func TestKillChildAfterCopyError(t *testing.T) {
9696
testenv.MustHaveExec(t)
9797

98-
defer func() { testHookStartProcess = nil }()
99-
proc := make(chan *os.Process, 1)
100-
testHookStartProcess = func(p *os.Process) {
101-
proc <- p
102-
}
103-
10498
h := &Handler{
10599
Path: os.Args[0],
106100
Root: "/test.go",
@@ -112,26 +106,9 @@ func TestKillChildAfterCopyError(t *testing.T) {
112106
const writeLen = 50 << 10
113107
rw := &customWriterRecorder{&limitWriter{&out, writeLen}, rec}
114108

115-
donec := make(chan bool, 1)
116-
go func() {
117-
h.ServeHTTP(rw, req)
118-
donec <- true
119-
}()
120-
121-
select {
122-
case <-donec:
123-
if out.Len() != writeLen || out.Bytes()[0] != 'a' {
124-
t.Errorf("unexpected output: %q", out.Bytes())
125-
}
126-
case <-time.After(5 * time.Second):
127-
t.Errorf("timeout. ServeHTTP hung and didn't kill the child process?")
128-
select {
129-
case p := <-proc:
130-
p.Kill()
131-
t.Logf("killed process")
132-
default:
133-
t.Logf("didn't kill process")
134-
}
109+
h.ServeHTTP(rw, req)
110+
if out.Len() != writeLen || out.Bytes()[0] != 'a' {
111+
t.Errorf("unexpected output: %q", out.Bytes())
135112
}
136113
}
137114

0 commit comments

Comments
 (0)