@@ -3,6 +3,7 @@ package e2e
33import (
44 "context"
55 "encoding/json"
6+ "errors"
67 "fmt"
78 "strings"
89 "time"
@@ -300,11 +301,11 @@ func validateWireServerBlocked(ctx context.Context, s *Scenario) {
300301
301302 checks := []wireServerCheck {
302303 {
303- cmd : "curl http://168.63.129.16/machine/?comp=goalstate -H 'x-ms-version: 2015-04-05' -s --connect-timeout 4" ,
304+ cmd : "curl http://168.63.129.16/machine/?comp=goalstate -H 'x-ms-version: 2015-04-05' -s --connect-timeout 4 --max-time 8 " ,
304305 desc : "wireserver port 80 goalstate" ,
305306 },
306307 {
307- cmd : "curl http://168.63.129.16:32526/vmSettings --connect-timeout 4" ,
308+ cmd : "curl http://168.63.129.16:32526/vmSettings --connect-timeout 4 --max-time 8 " ,
308309 desc : "wireserver port 32526 vmSettings" ,
309310 },
310311 }
@@ -313,10 +314,19 @@ func validateWireServerBlocked(ctx context.Context, s *Scenario) {
313314
314315 for _ , check := range checks {
315316 var execResult * podExecResult
316- pollErr := wait .PollUntilContextTimeout (ctx , 5 * time .Second , 30 * time .Second , true , func (ctx context.Context ) (bool , error ) {
317- r , execErr := execOnUnprivilegedPod (ctx , s .Runtime .Cluster .Kube , nonHostPod .Namespace , nonHostPod .Name , check .cmd )
317+ // Per-attempt cap (15s) prevents a single SPDY/exec hang from consuming the entire
318+ // poll budget. Derived from the poll's inner ctx so it honors both the per-attempt
319+ // cap and the overall poll deadline, whichever fires first.
320+ pollErr := wait .PollUntilContextTimeout (ctx , 5 * time .Second , 1 * time .Minute , true , func (ctx context.Context ) (bool , error ) {
321+ attemptCtx , cancel := context .WithTimeout (ctx , 15 * time .Second )
322+ defer cancel ()
323+ r , execErr := execOnUnprivilegedPod (attemptCtx , s .Runtime .Cluster .Kube , nonHostPod .Namespace , nonHostPod .Name , check .cmd )
318324 if execErr != nil {
319- s .T .Logf ("wireserver check %q: exec error (retrying): %v" , check .desc , execErr )
325+ if errors .Is (execErr , context .DeadlineExceeded ) {
326+ s .T .Logf ("wireserver check %q: exec attempt timed out after 15s (retrying): %v" , check .desc , execErr )
327+ } else {
328+ s .T .Logf ("wireserver check %q: exec error (retrying): %v" , check .desc , execErr )
329+ }
320330 return false , nil
321331 }
322332 execResult = r
0 commit comments