@@ -17,10 +17,35 @@ cleanup() {
1717 docker_e2e_docker_cmd rm -f " $CLI_NAME " > /dev/null 2>&1 || true
1818 " ${COMPOSE[@]} " down --remove-orphans --volumes > /dev/null 2>&1 || true
1919 docker_e2e_cleanup_package_tgz " $PACKAGE_TGZ "
20+ docker_e2e_docker_cmd run --rm --user 0:0 \
21+ -v " $PROJECT_DIR :/target" \
22+ " $IMAGE_NAME " \
23+ sh -c ' rm -rf /target/* /target/.[!.]* /target/..?*' > /dev/null 2>&1 || true
2024 rm -rf " $PROJECT_DIR "
2125}
2226trap cleanup EXIT
2327
28+ assert_gateway_health_json () {
29+ local label=" $1 "
30+ local health_path=" $2 "
31+ node - " $label " " $health_path " << 'NODE '
32+ const fs = require("node:fs");
33+ const label = process.argv[2];
34+ const healthPath = process.argv[3];
35+ const health = JSON.parse(fs.readFileSync(healthPath, "utf8"));
36+ if (
37+ health?.ok !== true ||
38+ !Number.isFinite(health.ts) ||
39+ !Number.isFinite(health.durationMs) ||
40+ !health.channels ||
41+ typeof health.channels !== "object" ||
42+ Array.isArray(health.channels)
43+ ) {
44+ throw new Error(`${label} gateway health JSON is incomplete`);
45+ }
46+ NODE
47+ }
48+
2449mkdir -p " $PROJECT_DIR /config/workspace" " $PROJECT_DIR /auth-profile"
2550chmod -R 0777 " $PROJECT_DIR /config" " $PROJECT_DIR /auth-profile"
2651cat > " $PROJECT_DIR /config/openclaw.json" << EOF
@@ -71,8 +96,11 @@ if [ "$(docker inspect --format '{{.State.Health.Status}}' "$GATEWAY_ID")" != "h
7196 exit 1
7297fi
7398
74- " ${COMPOSE[@]} " exec -T openclaw-gateway node dist/index.js health --token " $TOKEN "
75- " ${COMPOSE[@]} " run -T --no-deps --name " $CLI_NAME " openclaw-cli health --token " $TOKEN "
99+ " ${COMPOSE[@]} " exec -T openclaw-gateway sh -lc ' node dist/index.js gateway health --token "$OPENCLAW_GATEWAY_TOKEN"'
100+ " ${COMPOSE[@]} " exec -T openclaw-gateway node dist/index.js gateway health --token " $TOKEN " --json > " $PROJECT_DIR /gateway-health.json"
101+ assert_gateway_health_json " gateway service" " $PROJECT_DIR /gateway-health.json"
102+ " ${COMPOSE[@]} " run -T --no-deps --name " $CLI_NAME " openclaw-cli gateway health --token " $TOKEN " --json > " $PROJECT_DIR /cli-health.json"
103+ assert_gateway_health_json " CLI sidecar" " $PROJECT_DIR /cli-health.json"
76104GATEWAY_VERSION=" $( " ${COMPOSE[@]} " exec -T openclaw-gateway node -p " require('./package.json').version" ) "
77105
78106node --import tsx " $ROOT_DIR /scripts/e2e/lib/docker-artifact-proof/write-identities.ts" \
@@ -84,6 +112,8 @@ node --import tsx "$ROOT_DIR/scripts/e2e/lib/docker-artifact-proof/write-identit
84112 --container " cli=$CLI_NAME " \
85113 --detail " gateway:openclawVersion=$GATEWAY_VERSION " \
86114 --detail " gateway:health=healthy" \
87- --detail " cli:healthCommand=passed"
115+ --detail " gateway:documentedHealthCommand=passed" \
116+ --detail " gateway:healthJsonEnvelope=passed" \
117+ --detail " cli:healthJsonEnvelope=passed"
88118
89119echo " Docker Compose setup proof passed."
0 commit comments