@@ -2285,6 +2285,9 @@ spec:
22852285 namespace: %s
22862286`
22872287 BeforeEach (func () {
2288+ if framework .IngressVersion != "v1" {
2289+ Skip ("skipping test in non-v1 ingress version" )
2290+ }
22882291 s .DeployNginx (framework.NginxOptions {
22892292 Namespace : s .Namespace (),
22902293 Replicas : ptr .To (int32 (1 )),
@@ -2319,9 +2322,8 @@ spec:
23192322
23202323 applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "default" },
23212324 new (apiv2.ApisixRoute ), fmt .Sprintf (apisixRouteWithBackendWSS , s .Namespace ()))
2322- time .Sleep (6 * time .Second )
23232325
2324- By ("verify wss connection" )
2326+ By ("verify wss connection with retry " )
23252327 u := url.URL {
23262328 Scheme : "wss" ,
23272329 Host : s .GetAPISIXHTTPSEndpoint (),
@@ -2335,8 +2337,13 @@ spec:
23352337 },
23362338 }
23372339
2338- conn , resp , err := dialer .Dial (u .String (), headers )
2339- Expect (err ).ShouldNot (HaveOccurred (), "WebSocket handshake" )
2340+ var conn * websocket.Conn
2341+ var resp * http.Response
2342+ Eventually (func () error {
2343+ var dialErr error
2344+ conn , resp , dialErr = dialer .Dial (u .String (), headers )
2345+ return dialErr
2346+ }).WithTimeout (30 * time .Second ).WithPolling (2 * time .Second ).Should (Succeed (), "WebSocket handshake should succeed" )
23402347 Expect (resp .StatusCode ).Should (Equal (http .StatusSwitchingProtocols ))
23412348
23422349 defer func () {
0 commit comments