Skip to content

Commit 47cc035

Browse files
committed
tests
Change-Id: I6b5c1d592566a697e5590fb7ab4b4e559c818aa7
1 parent e4a1b94 commit 47cc035

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tests/tests.bats

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@
8282
for i in {1..10}
8383
do
8484
# Fetch the IP address assigned by the load balancer to the Gateway
85-
IP=$(kubectl get gateway my-gateway --output jsonpath='{.status.addresses[0].value}' 2>/dev/null) # Assuming Gateway name is 'my-gateway' and uses .status.addresses
85+
IP=$(kubectl get gateway prod-web --output jsonpath='{.status.addresses[0].value}' 2>/dev/null)
8686
# Check if IP is not empty and break the loop if found
87-
[[ ! -z "$IP" ]] && break || sleep 5
87+
[[ ! -z "$IP" ]] && break || sleep 1
8888
done
8989
# Fail the test if IP is still empty after retries
9090
if [[ -z "$IP" ]]; then
9191
echo "Failed to get Gateway IP address"
92-
kubectl logs -n kube-system -l control-plane=controller-manager # Example log command, adjust as needed
9392
return 1
9493
fi
9594
echo "Gateway IP: $IP"
@@ -104,7 +103,7 @@
104103
# Curl the /hostname endpoint via the Gateway IP, ignore failures temporarily
105104
HOSTNAME=$(curl -s --connect-timeout 5 http://${IP}:80/hostname || true)
106105
# Check if HOSTNAME is not empty and break the loop if successful
107-
[[ ! -z "$HOSTNAME" ]] && break || sleep 5
106+
[[ ! -z "$HOSTNAME" ]] && break || sleep 1
108107
done
109108
# Fail the test if HOSTNAME is still empty after retries
110109
if [[ -z "$HOSTNAME" ]]; then
@@ -117,7 +116,5 @@
117116
[ "$HOSTNAME" = "$POD" ]
118117

119118
# Cleanup: Delete the applied manifests
120-
# Use --ignore-not-found to avoid errors if cleanup runs multiple times or resources are already gone
121119
kubectl delete --ignore-not-found -f "$BATS_TEST_DIRNAME"/../examples/gateway_httproute_simple.yaml
122120
}
123-

0 commit comments

Comments
 (0)