Skip to content

Commit d518dfd

Browse files
committed
fix(examples): wait for agent port-forward before exec
1 parent 8c2d17e commit d518dfd

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

examples/tiny-smoke/run.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@ trap cleanup EXIT
5959
echo "[4/6] port-forward agent API via pod/${AGENT_POD}"
6060
kubectl -n "${IMP_NS}" port-forward "pod/${AGENT_POD}" "${LOCAL_AGENT_PORT}:9091" >/tmp/imp-tiny-smoke-portforward.log 2>&1 &
6161
PF_PID=$!
62-
sleep 2
62+
63+
for _ in $(seq 1 40); do
64+
if ss -lnt | awk '{print $4}' | grep -q ":${LOCAL_AGENT_PORT}$"; then
65+
break
66+
fi
67+
sleep 0.5
68+
done
69+
70+
if ! ss -lnt | awk '{print $4}' | grep -q ":${LOCAL_AGENT_PORT}$"; then
71+
echo "agent API port-forward did not become ready" >&2
72+
cat /tmp/imp-tiny-smoke-portforward.log >&2 || true
73+
exit 1
74+
fi
6375

6476
echo "[5/6] execute connectivity check from ${CLIENT_VM} -> ${SERVER_IP}"
6577
REQ_BODY="$(

0 commit comments

Comments
 (0)