@@ -641,12 +641,18 @@ var _ = SIGDescribe("Kubectl Port forwarding", func() {
641
641
642
642
ginkgo .By ("Send a http request to verify port-forward working" )
643
643
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 ,
645
647
}
646
648
resp , err := client .Get (fmt .Sprintf ("http://127.0.0.1:%d/" , cmd .port ))
647
649
framework .ExpectNoError (err , "couldn't get http response from port-forward" )
648
650
gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusOK ), "unexpected status code" )
649
651
652
+ ginkgo .By ("Close response body" )
653
+ err = resp .Body .Close ()
654
+ framework .ExpectNoError (err , "couldn't close response body" )
655
+
650
656
ginkgo .By ("Dialing the local port" )
651
657
conn , err := net .Dial ("tcp" , fmt .Sprintf ("127.0.0.1:%d" , cmd .port ))
652
658
framework .ExpectNoError (err , "couldn't connect to port %d" , cmd .port )
@@ -671,6 +677,10 @@ var _ = SIGDescribe("Kubectl Port forwarding", func() {
671
677
resp , err = client .Get (fmt .Sprintf ("http://127.0.0.1:%d/" , cmd .port ))
672
678
framework .ExpectNoError (err , "couldn't get http response from port-forward" )
673
679
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" )
674
684
})
675
685
})
676
686
})
0 commit comments