Skip to content

Commit 0fcaf17

Browse files
committed
test(docker): prove documented compose health command
1 parent 4363f74 commit 0fcaf17

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎scripts/e2e/compose-setup.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ if [ "$(docker inspect --format '{{.State.Health.Status}}' "$GATEWAY_ID")" != "h
9696
exit 1
9797
fi
9898

99+
"${COMPOSE[@]}" exec -T openclaw-gateway sh -lc 'node dist/index.js gateway health --token "$OPENCLAW_GATEWAY_TOKEN"'
99100
"${COMPOSE[@]}" exec -T openclaw-gateway node dist/index.js gateway health --token "$TOKEN" --json >"$PROJECT_DIR/gateway-health.json"
100101
assert_gateway_health_json "gateway service" "$PROJECT_DIR/gateway-health.json"
101102
"${COMPOSE[@]}" run -T --no-deps --name "$CLI_NAME" openclaw-cli gateway health --token "$TOKEN" --json >"$PROJECT_DIR/cli-health.json"
@@ -111,7 +112,8 @@ node --import tsx "$ROOT_DIR/scripts/e2e/lib/docker-artifact-proof/write-identit
111112
--container "cli=$CLI_NAME" \
112113
--detail "gateway:openclawVersion=$GATEWAY_VERSION" \
113114
--detail "gateway:health=healthy" \
114-
--detail "gateway:healthCommand=passed" \
115-
--detail "cli:healthCommand=passed"
115+
--detail "gateway:documentedHealthCommand=passed" \
116+
--detail "gateway:healthJsonEnvelope=passed" \
117+
--detail "cli:healthJsonEnvelope=passed"
116118

117119
echo "Docker Compose setup proof passed."

‎src/dockerfile.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,23 @@ describe("Dockerfile", () => {
4747
expect(compose).not.toContain("127.0.0.1:18789/healthz");
4848
});
4949

50-
it("uses the authenticated gateway health command in Compose guidance and proof", async () => {
50+
it("executes the documented Compose health command and validates JSON envelopes", async () => {
5151
const docs = await readFile(dockerInstallDocsPath, "utf8");
5252
const composeSetup = await readFile(composeSetupScriptPath, "utf8");
5353
const gatewayHealthCommand =
5454
'node dist/index.js gateway health --token "$OPENCLAW_GATEWAY_TOKEN"';
5555

5656
expect(docs).toContain(`docker compose exec openclaw-gateway sh -lc '${gatewayHealthCommand}'`);
5757
expect(docs).not.toContain('node dist/index.js health --token "$OPENCLAW_GATEWAY_TOKEN"');
58+
expect(composeSetup).toContain(
59+
`"\${COMPOSE[@]}" exec -T openclaw-gateway sh -lc '${gatewayHealthCommand}'`,
60+
);
5861
expect(composeSetup.match(/gateway health --token "\$TOKEN" --json/g)).toHaveLength(2);
5962
expect(composeSetup).toContain('assert_gateway_health_json "gateway service"');
6063
expect(composeSetup).toContain('assert_gateway_health_json "CLI sidecar"');
64+
expect(composeSetup).toContain('--detail "gateway:documentedHealthCommand=passed"');
65+
expect(composeSetup).toContain('--detail "gateway:healthJsonEnvelope=passed"');
66+
expect(composeSetup).toContain('--detail "cli:healthJsonEnvelope=passed"');
6167
expect(composeSetup).not.toContain('dist/index.js health --token "$TOKEN"');
6268
expect(composeSetup).toContain('-v "$PROJECT_DIR:/target"');
6369
expect(composeSetup).toContain("rm -rf /target/* /target/.[!.]* /target/..?*");

0 commit comments

Comments
 (0)