Skip to content

Commit 7d64008

Browse files
committed
UI smoke: verify HTML content in GET / and JSON-RPC in POST /rpc
1 parent 6300feb commit 7d64008

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

scripts/smoke-test.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,29 +1345,29 @@ UI_PID=$!
13451345
sleep 1
13461346

13471347
if kill -0 "$UI_PID" 2>/dev/null; then
1348-
# 15a: HTTP root returns 200
1349-
UI_STATUS=$(curl -sf -o /dev/null -w "%{http_code}" "http://127.0.0.1:$UI_PORT/" 2>/dev/null || echo "000")
1350-
if [ "$UI_STATUS" = "200" ]; then
1351-
echo "OK 15a: UI root returns 200"
1352-
elif [ "$UI_STATUS" = "000" ]; then
1348+
# 15a: GET / returns 200 with HTML content
1349+
UI_BODY=$(curl -sf "http://127.0.0.1:$UI_PORT/" 2>/dev/null || echo "")
1350+
if echo "$UI_BODY" | grep -qi "<html"; then
1351+
echo "OK 15a: UI serves HTML at /"
1352+
elif [ -z "$UI_BODY" ]; then
13531353
echo "SKIP 15a: UI not reachable (binary may not have embedded assets)"
13541354
else
1355-
echo "FAIL 15a: UI root returned $UI_STATUS"
1355+
echo "FAIL 15a: UI root did not return HTML"
13561356
kill "$UI_PID" 2>/dev/null || true
13571357
exit 1
13581358
fi
13591359

1360-
# 15b: /rpc endpoint accepts POST
1361-
RPC_STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X POST \
1360+
# 15b: POST /rpc accepts JSON-RPC and returns JSON
1361+
RPC_BODY=$(curl -sf -X POST \
13621362
-H "Content-Type: application/json" \
13631363
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
1364-
"http://127.0.0.1:$UI_PORT/rpc" 2>/dev/null || echo "000")
1365-
if [ "$RPC_STATUS" = "200" ]; then
1366-
echo "OK 15b: UI /rpc endpoint returns 200"
1367-
elif [ "$RPC_STATUS" = "000" ]; then
1364+
"http://127.0.0.1:$UI_PORT/rpc" 2>/dev/null || echo "")
1365+
if echo "$RPC_BODY" | grep -q "jsonrpc"; then
1366+
echo "OK 15b: /rpc returns JSON-RPC response"
1367+
elif [ -z "$RPC_BODY" ]; then
13681368
echo "SKIP 15b: /rpc not reachable"
13691369
else
1370-
echo "FAIL 15b: /rpc returned $RPC_STATUS"
1370+
echo "FAIL 15b: /rpc did not return JSON-RPC"
13711371
fi
13721372

13731373
kill "$UI_PID" 2>/dev/null || true

0 commit comments

Comments
 (0)