






















@@ -40,68 +40,37 @@ docker run --rm \
4040"${DOCKER_E2E_HARNESS_ARGS[@]}" \
4141"$IMAGE_NAME" \
4242 bash -lc "set -euo pipefail
43- eval \"\$(printf '%s' \"\${OPENCLAW_TEST_STATE_SCRIPT_B64:?missing OPENCLAW_TEST_STATE_SCRIPT_B64}\" | base64 -d)\"
44- entry=dist/index.mjs
45- [ -f \"\$entry\" ] || entry=dist/index.js
43+ source scripts/lib/openclaw-e2e-instance.sh
44+ openclaw_e2e_eval_test_state_from_b64 \"\${OPENCLAW_TEST_STATE_SCRIPT_B64:?missing OPENCLAW_TEST_STATE_SCRIPT_B64}\"
45+ entry=\"\$(openclaw_e2e_resolve_entrypoint)\"
4646 export MOCK_PORT=44081
4747 export SUCCESS_MARKER=OPENCLAW_CRON_MCP_CLEANUP_OK
4848 export MOCK_REQUEST_LOG=/tmp/openclaw-cron-mock-openai-requests.jsonl
4949 export OPENCLAW_DOCKER_OPENAI_BASE_URL=\"http://127.0.0.1:\$MOCK_PORT/v1\"
50- node scripts/e2e/mock-openai-server.mjs >/tmp/cron-mcp-cleanup-mock-openai.log 2>&1 &
51- mock_pid=\$!
52- tsx scripts/e2e/cron-mcp-cleanup-seed.ts >/tmp/cron-mcp-cleanup-seed.log
53- node \"\$entry\" gateway --port $PORT --bind loopback --allow-unconfigured >/tmp/cron-mcp-cleanup-gateway.log 2>&1 &
54- gateway_pid=\$!
55- stop_process() {
56- pid=\"\$1\"
57- kill \"\$pid\" >/dev/null 2>&1 || true
58- for _ in \$(seq 1 40); do
59- if ! kill -0 \"\$pid\" >/dev/null 2>&1; then
60- wait \"\$pid\" >/dev/null 2>&1 || true
61- return
62- fi
63- sleep 0.25
64- done
65- kill -9 \"\$pid\" >/dev/null 2>&1 || true
66- wait \"\$pid\" >/dev/null 2>&1 || true
67- }
50+ mock_pid=\"\$(openclaw_e2e_start_mock_openai \"\$MOCK_PORT\" /tmp/cron-mcp-cleanup-mock-openai.log)\"
51+ gateway_pid=
6852 cleanup_inner() {
69- stop_process \"\$mock_pid\"
70- stop_process \"\$gateway_pid\"
53+ openclaw_e2e_stop_process \"\${gateway_pid:-}\"
54+ openclaw_e2e_stop_process \"\${mock_pid:-}\"
7155 }
7256 dump_gateway_log_on_error() {
7357 status=\$?
7458 if [ \"\$status\" -ne 0 ]; then
75- tail -n 80 /tmp/cron-mcp-cleanup-gateway.log 2>/dev/null || true
76- cat /tmp/cron-mcp-cleanup-seed.log 2>/dev/null || true
77- cat /tmp/cron-mcp-cleanup-mock-openai.log 2>/dev/null || true
78- cat \"\$MOCK_REQUEST_LOG\" 2>/dev/null || true
59+ openclaw_e2e_dump_logs \
60+ /tmp/cron-mcp-cleanup-gateway.log \
61+ /tmp/cron-mcp-cleanup-seed.log \
62+ /tmp/cron-mcp-cleanup-mock-openai.log \
63+ \"\$MOCK_REQUEST_LOG\"
7964 fi
8065 cleanup_inner
8166 exit \"\$status\"
8267 }
8368 trap cleanup_inner EXIT
8469 trap dump_gateway_log_on_error ERR
85- for _ in \$(seq 1 80); do
86- if node -e \"fetch('http://127.0.0.1:' + process.env.MOCK_PORT + '/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\"; then
87- break
88- fi
89- sleep 0.1
90- done
91- node -e \"fetch('http://127.0.0.1:' + process.env.MOCK_PORT + '/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\"
92- gateway_ready=0
93- for _ in \$(seq 1 300); do
94- if grep -q '\[gateway\] ready' /tmp/cron-mcp-cleanup-gateway.log 2>/dev/null; then
95- gateway_ready=1
96- break
97- fi
98- sleep 0.25
99- done
100- if [ \"\$gateway_ready\" -ne 1 ]; then
101- echo \"Gateway did not become ready\"
102- tail -n 120 /tmp/cron-mcp-cleanup-gateway.log 2>/dev/null || true
103- exit 1
104- fi
70+ openclaw_e2e_wait_mock_openai \"\$MOCK_PORT\"
71+ tsx scripts/e2e/cron-mcp-cleanup-seed.ts >/tmp/cron-mcp-cleanup-seed.log
72+ gateway_pid=\"\$(openclaw_e2e_start_gateway \"\$entry\" $PORT /tmp/cron-mcp-cleanup-gateway.log)\"
73+ openclaw_e2e_wait_gateway_ready \"\$gateway_pid\" /tmp/cron-mcp-cleanup-gateway.log 300
10574 tsx scripts/e2e/cron-mcp-cleanup-docker-client.ts
10675 " >"$CLIENT_LOG" 2>&1
10776status=${PIPESTATUS[0]}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。