
























@@ -16,6 +16,7 @@ cleanup() {
1616trap cleanup EXIT
17171818docker_e2e_build_or_reuse "$IMAGE_NAME" config-reload "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR" "" "$SKIP_BUILD"
19+docker_e2e_harness_mount_args
1920OPENCLAW_TEST_STATE_SCRIPT_B64="$(docker_e2e_test_state_shell_b64 config-reload empty)"
20212122echo "Starting gateway container..."
@@ -29,19 +30,13 @@ docker run -d \
2930 -e OPENCLAW_SKIP_CRON=1 \
3031 -e OPENCLAW_SKIP_CANVAS_HOST=1 \
3132 -e "OPENCLAW_TEST_STATE_SCRIPT_B64=$OPENCLAW_TEST_STATE_SCRIPT_B64" \
33+"${DOCKER_E2E_HARNESS_ARGS[@]}" \
3234"$IMAGE_NAME" \
3335 bash -lc "set -euo pipefail
34-eval \"\$(printf '%s' \"\${OPENCLAW_TEST_STATE_SCRIPT_B64:?missing OPENCLAW_TEST_STATE_SCRIPT_B64}\" | base64 -d)\"
35-{
36- printf 'export HOME=%q\n' \"\$HOME\"
37- printf 'export OPENCLAW_HOME=%q\n' \"\$OPENCLAW_HOME\"
38- printf 'export OPENCLAW_STATE_DIR=%q\n' \"\$OPENCLAW_STATE_DIR\"
39- printf 'export OPENCLAW_CONFIG_PATH=%q\n' \"\$OPENCLAW_CONFIG_PATH\"
40- printf 'export OPENCLAW_AGENT_DIR=%q\n' \"\${OPENCLAW_AGENT_DIR-}\"
41- printf 'export PI_CODING_AGENT_DIR=%q\n' \"\${PI_CODING_AGENT_DIR-}\"
42-} >/tmp/openclaw-test-state-env
43-entry=dist/index.mjs
44-[ -f \"\$entry\" ] || entry=dist/index.js
36+source scripts/lib/openclaw-e2e-instance.sh
37+openclaw_e2e_eval_test_state_from_b64 \"\${OPENCLAW_TEST_STATE_SCRIPT_B64:?missing OPENCLAW_TEST_STATE_SCRIPT_B64}\"
38+openclaw_e2e_write_state_env
39+entry=\"\$(openclaw_e2e_resolve_entrypoint)\"
4540cat > \"\$OPENCLAW_CONFIG_PATH\" <<'JSON'
4641{
4742 \"gateway\": {
@@ -65,31 +60,15 @@ cat > \"\$OPENCLAW_CONFIG_PATH\" <<'JSON'
6560 }
6661}
6762JSON
68-node \"\$entry\" gateway --port $PORT --bind loopback --allow-unconfigured > /tmp/config-reload-e2e.log 2>&1" >/dev/null
63+openclaw_e2e_exec_gateway \"\$entry\" $PORT loopback /tmp/config-reload-e2e.log" >/dev/null
69647065echo "Waiting for gateway..."
7166ready=0
7267for _ in $(seq 1 180); do
7368if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null || echo false)" != "true" ]; then
7469break
7570fi
76-if docker exec "$CONTAINER_NAME" bash -lc "node --input-type=module -e '
77- import net from \"node:net\";
78- const socket = net.createConnection({ host: \"127.0.0.1\", port: $PORT });
79- const timeout = setTimeout(() => {
80- socket.destroy();
81- process.exit(1);
82- }, 400);
83- socket.on(\"connect\", () => {
84- clearTimeout(timeout);
85- socket.end();
86- process.exit(0);
87- });
88- socket.on(\"error\", () => {
89- clearTimeout(timeout);
90- process.exit(1);
91- });
92- ' >/dev/null 2>&1"; then
71+if docker exec "$CONTAINER_NAME" bash -lc "source scripts/lib/openclaw-e2e-instance.sh; openclaw_e2e_probe_tcp 127.0.0.1 $PORT" >/dev/null 2>&1; then
9372 ready=1
9473break
9574fi
@@ -106,8 +85,8 @@ fi
10685echo "Checking initial RPC status..."
10786docker exec "$CONTAINER_NAME" bash -lc "
10887source /tmp/openclaw-test-state-env
109-entry=dist/index.mjs
110-[ -f \"\$entry\" ] || entry=dist/index.js
88+source scripts/lib/openclaw-e2e-instance.sh
89+entry=\"\$(openclaw_e2e_resolve_entrypoint)\"
11190node \"\$entry\" gateway status --url ws://127.0.0.1:$PORT --token '$TOKEN' --require-rpc --timeout 30000 >/tmp/config-reload-status-before.log
11291"
11392@@ -133,8 +112,8 @@ fi
133112echo "Checking post-write RPC status..."
134113docker exec "$CONTAINER_NAME" bash -lc "
135114source /tmp/openclaw-test-state-env
136-entry=dist/index.mjs
137-[ -f \"\$entry\" ] || entry=dist/index.js
115+source scripts/lib/openclaw-e2e-instance.sh
116+entry=\"\$(openclaw_e2e_resolve_entrypoint)\"
138117node \"\$entry\" gateway status --url ws://127.0.0.1:$PORT --token '$TOKEN' --require-rpc --timeout 30000 >/tmp/config-reload-status-after.log
139118"
140119此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。