




















@@ -11,7 +11,7 @@ TOKEN="reload-e2e-token"
1111CONTAINER_NAME="openclaw-config-reload-e2e-$$"
12121313cleanup() {
14-docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true
14+docker_e2e_docker_cmd rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true
1515}
1616trap cleanup EXIT
1717@@ -61,88 +61,42 @@ JSON
6161openclaw_e2e_exec_gateway \"\$entry\" $PORT loopback /tmp/config-reload-e2e.log" >/dev/null
62626363echo "Waiting for gateway..."
64-ready=0
65-for _ in $(seq 1 180); do
66-if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null || echo false)" != "true" ]; then
67-break
68-fi
69-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
70- ready=1
71-break
72-fi
73- sleep 0.5
74-done
75-76-if [ "$ready" -ne 1 ]; then
64+if ! docker_e2e_wait_container_bash "$CONTAINER_NAME" 180 0.5 "source scripts/lib/openclaw-e2e-instance.sh; openclaw_e2e_probe_tcp 127.0.0.1 $PORT"; then
7765echo "Gateway failed to start"
78-docker logs "$CONTAINER_NAME" 2>&1 | tail -n 120 || true
79-docker exec "$CONTAINER_NAME" bash -lc "tail -n 120 /tmp/config-reload-e2e.log" || true
66+docker_e2e_docker_cmd logs "$CONTAINER_NAME" 2>&1 | tail -n 120 || true
67+docker_e2e_docker_cmd exec "$CONTAINER_NAME" bash -lc "tail -n 120 /tmp/config-reload-e2e.log" || true
8068exit 1
8169fi
82708371echo "Checking initial RPC status..."
84-docker exec "$CONTAINER_NAME" bash -lc "
72+docker_e2e_docker_cmd exec "$CONTAINER_NAME" bash -lc "
8573source /tmp/openclaw-test-state-env
8674source scripts/lib/openclaw-e2e-instance.sh
8775entry=\"\$(openclaw_e2e_resolve_entrypoint)\"
8876node \"\$entry\" gateway status --url ws://127.0.0.1:$PORT --token '$TOKEN' --require-rpc --timeout 30000 >/tmp/config-reload-status-before.log
8977"
90789179echo "Mutating hot-reload gateway metadata..."
92-docker exec "$CONTAINER_NAME" bash -lc "source /tmp/openclaw-test-state-env
93-node --input-type=module - <<'NODE'
94-import fs from 'node:fs';
95-96-const configPath = process.env.OPENCLAW_CONFIG_PATH;
97-const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
98-config.gateway.channelHealthCheckMinutes = 2;
99-fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
100-NODE"
80+docker_e2e_docker_cmd exec "$CONTAINER_NAME" bash -lc "source /tmp/openclaw-test-state-env
81+node scripts/e2e/lib/config-reload/mutate-metadata.mjs"
1018210283sleep 2
10384104-if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null || echo false)" != "true" ]; then
85+if [ "$(docker_e2e_docker_cmd inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null || echo false)" != "true" ]; then
10586echo "Gateway container exited after config metadata write"
106-docker logs "$CONTAINER_NAME" 2>&1 | tail -n 120 || true
87+docker_e2e_docker_cmd logs "$CONTAINER_NAME" 2>&1 | tail -n 120 || true
10788exit 1
10889fi
1099011091echo "Checking post-write RPC status..."
111-docker exec "$CONTAINER_NAME" bash -lc "
92+docker_e2e_docker_cmd exec "$CONTAINER_NAME" bash -lc "
11293source /tmp/openclaw-test-state-env
11394source scripts/lib/openclaw-e2e-instance.sh
11495entry=\"\$(openclaw_e2e_resolve_entrypoint)\"
11596node \"\$entry\" gateway status --url ws://127.0.0.1:$PORT --token '$TOKEN' --require-rpc --timeout 30000 >/tmp/config-reload-status-after.log
11697"
1179811899echo "Checking reload log..."
119-docker exec "$CONTAINER_NAME" bash -lc "node --input-type=module - <<'NODE'
120-import fs from 'node:fs';
121-122-const log = fs.readFileSync('/tmp/config-reload-e2e.log', 'utf8');
123-const reloadLines = log
124- .split('\n')
125- .filter((line) => line.includes('config change detected; evaluating reload'));
126-const restartLines = log
127- .split('\n')
128- .filter((line) => line.includes('config change requires gateway restart'));
129-if (restartLines.length > 0) {
130- console.error(log.split('\n').slice(-160).join('\n'));
131- throw new Error('unexpected restart-required reload line found');
132-}
133-for (const line of reloadLines) {
134- for (const needle of ['gateway.auth.token', 'plugins.entries.firecrawl.config.webFetch']) {
135- if (line.includes(needle)) {
136- console.error(log.split('\n').slice(-160).join('\n'));
137- throw new Error('runtime-only path appeared in reload diff: ' + needle);
138- }
139- }
140-}
141-if (reloadLines.length === 0) {
142- console.error(log.split('\n').slice(-160).join('\n'));
143- throw new Error('expected config reload detection log after metadata write');
144-}
145-console.log('ok');
146-NODE"
100+docker_e2e_docker_cmd exec "$CONTAINER_NAME" bash -lc "node scripts/e2e/lib/config-reload/assert-log.mjs"
147101148102echo "Config reload Docker E2E passed."
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。