@@ -641,12 +641,18 @@ var _ = SIGDescribe("Kubectl Port forwarding", func() {
641641
642642 ginkgo .By ("Send a http request to verify port-forward working" )
643643 client := http.Client {
644- Timeout : 15 * time .Second ,
644+ // As discussed in https://github.com/kubernetes/kubernetes/pull/133682#issuecomment-3228372990,
645+ // 30 second should be sufficient to complete.
646+ Timeout : 30 * time .Second ,
645647 }
646648 resp , err := client .Get (fmt .Sprintf ("http://127.0.0.1:%d/" , cmd .port ))
647649 framework .ExpectNoError (err , "couldn't get http response from port-forward" )
648650 gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusOK ), "unexpected status code" )
649651
652+ ginkgo .By ("Close response body" )
653+ err = resp .Body .Close ()
654+ framework .ExpectNoError (err , "couldn't close response body" )
655+
650656 ginkgo .By ("Dialing the local port" )
651657 conn , err := net .Dial ("tcp" , fmt .Sprintf ("127.0.0.1:%d" , cmd .port ))
652658 framework .ExpectNoError (err , "couldn't connect to port %d" , cmd .port )
@@ -671,6 +677,10 @@ var _ = SIGDescribe("Kubectl Port forwarding", func() {
671677 resp , err = client .Get (fmt .Sprintf ("http://127.0.0.1:%d/" , cmd .port ))
672678 framework .ExpectNoError (err , "couldn't get http response from port-forward" )
673679 gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusOK ), "unexpected status code" )
680+
681+ ginkgo .By ("Close response body" )
682+ err = resp .Body .Close ()
683+ framework .ExpectNoError (err , "couldn't close response body" )
674684 })
675685 })
676686})
0 commit comments