test
This commit is contained in:
@@ -155,6 +155,9 @@ _start_fe() {
|
|||||||
sleep 2
|
sleep 2
|
||||||
if [[ -f "$pidfile" ]] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
if [[ -f "$pidfile" ]] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
||||||
success " ✓ $name (PID=$(cat "$pidfile")) ${FE_PORT[$name]} → $logfile"
|
success " ✓ $name (PID=$(cat "$pidfile")) ${FE_PORT[$name]} → $logfile"
|
||||||
|
if [[ "$name" == "pc" ]]; then
|
||||||
|
pc_check_wasm_assets "http://${DEPLOY_TEST_IP}:5173"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
error " ✗ $name 启动失败,查看日志:"
|
error " ✗ $name 启动失败,查看日志:"
|
||||||
tail -20 "$logfile" 2>/dev/null || true
|
tail -20 "$logfile" 2>/dev/null || true
|
||||||
|
|||||||
22
common.sh
22
common.sh
@@ -297,3 +297,25 @@ pc_probe_msg_gateway() {
|
|||||||
|
|
||||||
info " MsgGateway Nginx 入口: ${o}/msg_gateway(不做无 token HTTP 探测,避免在 openim-server.log 中产生 token is empty 告警)"
|
info " MsgGateway Nginx 入口: ${o}/msg_gateway(不做无 token HTTP 探测,避免在 openim-server.log 中产生 token is empty 告警)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pc_check_wasm_assets() {
|
||||||
|
local origin="${1:-}"
|
||||||
|
origin="${origin%/}"
|
||||||
|
[[ -z "$origin" ]] && return 0
|
||||||
|
|
||||||
|
if ! command -v curl &>/dev/null; then
|
||||||
|
warn " 未安装 curl,跳过 PC WASM 资源检查"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local asset url ct
|
||||||
|
for asset in openIM.wasm sql-wasm.wasm wasm_exec.js; do
|
||||||
|
url="${origin}/${asset}"
|
||||||
|
if curl -fsS --max-time 5 "$url" >/dev/null 2>&1; then
|
||||||
|
ct=$(curl -fsSI --max-time 5 "$url" 2>/dev/null | awk 'BEGIN{IGNORECASE=1} /^content-type:/ {sub(/\r$/, ""); print $0; exit}' || true)
|
||||||
|
success " PC SDK 资源可达: ${url}${ct:+ (${ct#*: })}"
|
||||||
|
else
|
||||||
|
warn " PC SDK 资源不可达: ${url}(SDK login 可能卡住且不会发起 /msg_gateway WebSocket)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user