op-packages/luci-app-openclaw/tests/test_status_contract.sh
github-actions[bot] 196c79549d 🎈 Sync 2026-06-08 16:57:14
2026-06-08 16:57:14 +08:00

26 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
REPO_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
CONTROLLER="$REPO_ROOT/luasrc/controller/openclaw.lua"
STATUS_VIEW="$REPO_ROOT/luasrc/view/openclaw/status.htm"
INIT_SCRIPT="$REPO_ROOT/root/etc/init.d/openclaw"
fail() {
echo "FAIL: $1" >&2
exit 1
}
grep -Fq "ubus call service list" "$CONTROLLER" || fail "status API should inspect procd state via ubus"
grep -Fq "openclaw.instances.gateway" "$CONTROLLER" || fail "status API should inspect gateway instance state"
grep -Fq "gateway_failed" "$CONTROLLER" || fail "status API should report gateway failure state"
grep -Fq "gateway_exit_code" "$CONTROLLER" || fail "status API should expose recent gateway exit code"
grep -Fq "启动失败" "$STATUS_VIEW" || fail "status panel should distinguish startup failure from startup in progress"
grep -Fq "gateway_failed" "$STATUS_VIEW" || fail "status panel should render gateway failure state"
grep -Fq "ubus call service list" "$INIT_SCRIPT" || fail "status_service should inspect procd state via ubus"
echo "ok"