@@ -841,7 +841,6 @@ jobs:
841841 name: test-gateway
842842 namespace: default
843843 spec:
844- gatewayClassName: "test"
845844 apiSelector:
846845 scope: Cluster
847846 configRef:
@@ -1296,7 +1295,6 @@ jobs:
12961295 name: scoped-gateway
12971296 namespace: scoped-test
12981297 spec:
1299- gatewayClassName: "test"
13001298 apiSelector:
13011299 scope: Cluster
13021300 configRef:
@@ -1330,18 +1328,41 @@ jobs:
13301328 kubectl wait --for=condition=Programmed restapi/scoped-api -n scoped-test --timeout=120s
13311329
13321330 echo "Invoking scoped API..."
1331+
1332+ # Wait for the router deployment to be fully ready
1333+ echo "Waiting for scoped gateway router deployment rollout..."
1334+ kubectl rollout status deployment/scoped-gateway-gateway-router -n scoped-test --timeout=120s
1335+
1336+ # Additional wait for Envoy to initialize and start listening
1337+ echo "Waiting for router to be ready to accept connections..."
1338+ sleep 10
1339+
13331340 # Port forward the scoped gateway router
13341341 kubectl port-forward svc/scoped-gateway-gateway-router -n scoped-test 9090:8080 &
13351342 PF_PID=$!
13361343 sleep 5
13371344
1338- CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9090/scoped/get)
1339- echo "Scoped API returned: $CODE"
1345+ # Retry logic for API invocation
1346+ MAX_RETRIES=5
1347+ RETRY_DELAY=5
1348+ CODE=""
1349+ for i in $(seq 1 $MAX_RETRIES); do
1350+ echo "Attempt $i of $MAX_RETRIES..."
1351+ CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 http://localhost:9090/scoped/get 2>/dev/null || echo "000")
1352+ echo "Scoped API returned: $CODE"
1353+ if [ "$CODE" = "200" ]; then
1354+ break
1355+ fi
1356+ if [ "$i" -lt "$MAX_RETRIES" ]; then
1357+ echo "Retrying in ${RETRY_DELAY}s..."
1358+ sleep $RETRY_DELAY
1359+ fi
1360+ done
13401361
13411362 kill $PF_PID || true
13421363
13431364 if [ "$CODE" != "200" ]; then
1344- echo "FAILED: Scoped API invocation failed"
1365+ echo "FAILED: Scoped API invocation failed after $MAX_RETRIES attempts "
13451366 exit 1
13461367 fi
13471368
0 commit comments