Skip to content

Commit 722ddf4

Browse files
committed
wip: solving cicd websocket issue
1 parent 8981ffb commit 722ddf4

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

.github/workflows/solana-unit-tests.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,27 @@ jobs:
7676
exit 1
7777
fi
7878
79+
echo "Waiting for WS port on 127.0.0.1:8900 ..."
80+
ws_ok=0
81+
for i in $(seq 1 60); do
82+
if command -v nc >/dev/null 2>&1; then
83+
if nc -z 127.0.0.1 8900 >/dev/null 2>&1; then ws_ok=1; break; fi
84+
else
85+
if (exec 3<>/dev/tcp/127.0.0.1/8900) 2>/dev/null; then exec 3>&- 3<&-; ws_ok=1; break; fi
86+
fi
87+
sleep 2
88+
done
89+
if [ "$ws_ok" -ne 1 ]; then
90+
echo "WebSocket port 8900 not reachable; dumping diagnostics" >&2
91+
if command -v ss >/dev/null 2>&1; then ss -ltnp || true; fi
92+
if command -v lsof >/dev/null 2>&1; then lsof -iTCP -sTCP:LISTEN || true; fi
93+
kubectl get svc -A -o wide || true
94+
if [ -n "${NS}" ]; then
95+
kubectl get pods -n "$NS" -o wide || true
96+
kubectl describe pod "$POD_NAME" -n "$NS" || true
97+
fi
98+
exit 1
99+
fi
100+
79101
cd ./networks/solana
80102
yarn test --runInBand

networks/solana/starship/port-forward.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,20 @@ start_pf() {
4949
# Health check: wait for local port to open
5050
local ok=0
5151
for _ in $(seq 1 $CHECK_RETRIES); do
52-
if nc -z 127.0.0.1 "$local_port" >/dev/null 2>&1; then
53-
ok=1
54-
break
52+
# Prefer nc if available; otherwise use bash's /dev/tcp
53+
if command -v nc >/dev/null 2>&1; then
54+
if nc -z 127.0.0.1 "$local_port" >/dev/null 2>&1; then
55+
ok=1
56+
break
57+
fi
58+
else
59+
if (exec 3<>/dev/tcp/127.0.0.1/"$local_port") 2>/dev/null; then
60+
# Close the FD we just opened
61+
exec 3>&-
62+
exec 3<&-
63+
ok=1
64+
break
65+
fi
5566
fi
5667
sleep "$SLEEP_BETWEEN"
5768
done

0 commit comments

Comments
 (0)