FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
net/http: fix broken TestIssue4191_InfiniteGetToPutTimeout

Test creates 2 tcp connections for put and get. Make sure
these are closed properly after test is over, otherwise
server hangs waiting for connection to be closed.

Please review this at http://codereview.appspot.com/6842109/

Affected files:
M src/pkg/net/http/transport_test.go


Index: src/pkg/net/http/transport_test.go
===================================================================
--- a/src/pkg/net/http/transport_test.go
+++ b/src/pkg/net/http/transport_test.go
@@ -980,6 +980,25 @@
},
}

+ getput := func() error {
+ sres, err := client.Get(ts.URL + "/get")
+ if err != nil {
+ return fmt.Errorf("Error issuing GET: %v", err)
+ }
+ defer sres.Body.Close()
+
+ req, err := NewRequest("PUT", ts.URL+"/put", sres.Body)
+ if err != nil {
+ return fmt.Errorf("Error in NewRequest: %v", err)
+ }
+ defer req.Body.Close()
+ _, err = client.Do(req)
+ if err == nil {
+ return fmt.Errorf("Unexpected successful PUT")
+ }
+ return nil
+ }
+
nRuns := 5
if testing.Short() {
nRuns = 1
@@ -988,15 +1007,8 @@
if debug {
println("run", i+1, "of", nRuns)
}
- sres, err := client.Get(ts.URL + "/get")
- if err != nil {
- t.Errorf("Error issuing GET: %v", err)
- break
- }
- req, _ := NewRequest("PUT", ts.URL+"/put", sres.Body)
- _, err = client.Do(req)
- if err == nil {
- t.Errorf("Unexpected successful PUT")
+ if err := getput(); err != nil {
+ t.Error(err)
break
}
}

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 28, '12 at 4:19a
activeNov 28, '12 at 6:01a
posts11
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase