fix(e2e): fail hard when OpenClaw gateway doesn't start (#2111)

The gateway startup was silently swallowed with log_warn, masking
real failures. Now tracks whether the port came up and fails the
test with the gateway log contents if it didn't.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
This commit is contained in:
Ahmed Abushagur 2026-03-02 10:51:29 -08:00 committed by GitHub
parent 1c35f648b9
commit 35badf8d1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,11 +89,16 @@ input_test_openclaw() {
_oc_bin=\$(command -v openclaw) || exit 1; \
if command -v setsid >/dev/null 2>&1; then setsid \"\$_oc_bin\" gateway > /tmp/openclaw-gateway.log 2>&1 < /dev/null & \
else nohup \"\$_oc_bin\" gateway > /tmp/openclaw-gateway.log 2>&1 < /dev/null & fi; \
elapsed=0; while [ \$elapsed -lt 30 ]; do \
if (echo >/dev/tcp/127.0.0.1/18789) 2>/dev/null || nc -z 127.0.0.1 18789 2>/dev/null; then echo 'Gateway started'; break; fi; \
elapsed=0; _gw_up=0; while [ \$elapsed -lt 30 ]; do \
if (echo >/dev/tcp/127.0.0.1/18789) 2>/dev/null || nc -z 127.0.0.1 18789 2>/dev/null; then echo 'Gateway started'; _gw_up=1; break; fi; \
sleep 1; elapsed=\$((elapsed + 1)); \
done; \
fi" >/dev/null 2>&1 || log_warn "Failed to start openclaw gateway"
if [ \$_gw_up -eq 0 ]; then echo 'Gateway failed to start after 30s'; cat /tmp/openclaw-gateway.log 2>/dev/null; exit 1; fi; \
fi" >/dev/null 2>&1
if [ $? -ne 0 ]; then
log_err "OpenClaw gateway failed to start"
return 1
fi
local encoded_prompt
encoded_prompt=$(printf '%s' "${INPUT_TEST_PROMPT}" | base64 -w 0 2>/dev/null || printf '%s' "${INPUT_TEST_PROMPT}" | base64)