Files
computer-playbook/roles/web-app-openclaw/files/test/test.sh
kevinveenbirkenbachandClaude Opus 5 a432535847 fix(openclaw): a failed exec is not a passing probe
The CLI test discarded the exec status with `|| true` and judged the run on
its output alone: non-empty, and not carrying a `failed to start server`
line. `Error response from daemon: No such container: <id>` satisfies both,
so the script echoed the daemon's error, printed ALL CHECKS PASSED and
exited 0. CI reported green for a container it never reached.

That path was live in run 33785198875 job 100756596935, where hermes_hermes.1
sat on a worker while roles/test-e2e-cli ran the exec on the manager. The
harness half of that failure is a separate change; this one is about the
predicate, which would have reported success for any unreachable container in
any mode.

Capture the status and require it. The output guard stays as it is: no
positive success marker is introduced, because nothing in the repository
records what `mcp probe` prints when it succeeds, and a guessed marker can
break a working test. web-app-hermes keys on `Tools discovered:` for the same
reason the other way round, but that string is its own.

The condition gains a conjunct, so no case that was checked before is
unchecked now. The residual runs the other way: should the probe ever exit
non-zero while still producing usable output, a run that passed will now
fail.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 02:14:50 +02:00

37 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# CLI test for web-app-openclaw: the agent reaches every MCP server it was
# configured against.
#
# Env (rendered into test.env from templates/test.env.j2):
# MCP_TEST_ENABLED whether this round configures MCP for OpenClaw at all
# MCP_CLIENT_CONTAINER addressable OpenClaw container
set -euo pipefail
: "${MCP_TEST_ENABLED:?}"
: "${MCP_CLIENT_CONTAINER:?}"
RETRIES=20
SLEEP_SECONDS=6
if [[ "${MCP_TEST_ENABLED}" != "true" ]]; then
echo "SKIP: MCP is switched off in this round"
exit 0
fi
attempt=0
while :; do
reached=0
out="$(container exec -i "${MCP_CLIENT_CONTAINER}" node dist/index.js mcp probe 2>&1)" || reached=$?
if [[ ${reached} -eq 0 && -n "${out}" && "${out}" != *"failed to start server"* ]]; then
echo "${out}"
echo "ALL CHECKS PASSED"
exit 0
fi
attempt=$((attempt + 1))
if [[ ${attempt} -ge ${RETRIES} ]]; then
echo "[FAIL] OpenClaw could not connect to a configured MCP server: ${out}" >&2
exit 1
fi
sleep "${SLEEP_SECONDS}"
done