Skip to content

Commit 66b4dcf

Browse files
authored
chore(docker): execute Compose and package artifact proofs (#101045)
* test(docker): prove Compose and package artifacts * test(docker): use bounded container cleanup * test(docker): bound package proof launch * test(qa): keep Docker artifact proofs release-only * test(docker): simplify artifact proof names * test(docker): satisfy identity writer lint
1 parent 2f7299e commit 66b4dcf

14 files changed

Lines changed: 780 additions & 56 deletions

‎extensions/qa-lab/src/coverage-report.test.ts‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ function scenarioWithCoverage(params: {
143143

144144
describe("qa coverage report", () => {
145145
it("groups scenario coverage metadata by theme and surface", () => {
146-
const inventory = buildQaCoverageInventory(readQaScenarioPack().scenarios);
146+
const scenarios = readQaScenarioPack().scenarios;
147+
const inventory = buildQaCoverageInventory(scenarios);
147148

148149
expect(inventory.scenarioCount).toBeGreaterThan(0);
149150
expect(inventory.coverageIdCount).toBeGreaterThan(0);
@@ -169,6 +170,22 @@ describe("qa coverage report", () => {
169170
).toMatchObject({
170171
channelDriver: "live",
171172
});
173+
for (const [categoryId, scenarioRef] of [
174+
["docker-podman-hosting.container-setup", "qa/scenarios/runtime/compose-setup.yaml"],
175+
[
176+
"docker-podman-hosting.image-release-and-validation",
177+
"qa/scenarios/runtime/docker-package-install.yaml",
178+
],
179+
] as const) {
180+
const category = inventory.scorecardTaxonomy.categories.find(
181+
(entry) => entry.id === categoryId,
182+
);
183+
expect(category?.profiles).toContain("release");
184+
expect(category?.profiles).not.toContain("smoke-ci");
185+
expect(scenarios.find((scenario) => scenario.sourcePath === scenarioRef)?.category).toBe(
186+
categoryId,
187+
);
188+
}
172189
expect(
173190
inventory.scorecardTaxonomy.profiles.find((profile) => profile.id === "all"),
174191
).toMatchObject({

‎package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,7 @@
17961796
"test:docker:cron-mcp-cleanup": "bash scripts/e2e/cron-mcp-cleanup-docker.sh",
17971797
"test:docker:codex-media-path": "bash scripts/e2e/codex-media-path-docker.sh",
17981798
"test:docker:doctor-switch": "bash scripts/e2e/doctor-install-switch-docker.sh",
1799+
"test:docker:compose-setup": "bash scripts/e2e/compose-setup.sh",
17991800
"test:docker:e2e-build": "bash scripts/e2e/build-image.sh",
18001801
"test:docker:gateway-network": "bash scripts/e2e/gateway-network-docker.sh",
18011802
"test:docker:kitchen-sink-plugin": "bash scripts/e2e/kitchen-sink-plugin-docker.sh",
@@ -1848,6 +1849,7 @@
18481849
"test:docker:openai-image-auth": "bash scripts/e2e/openai-image-auth-docker.sh",
18491850
"test:docker:openai-web-search-minimal": "bash scripts/e2e/openai-web-search-minimal-docker.sh",
18501851
"test:docker:openwebui": "bash scripts/e2e/openwebui-docker.sh",
1852+
"test:docker:package-install": "bash scripts/e2e/docker-package-install.sh",
18511853
"test:docker:plugin-binding-command-escape": "bash scripts/e2e/plugin-binding-command-escape-docker.sh",
18521854
"test:docker:plugin-lifecycle-matrix": "bash scripts/e2e/plugin-lifecycle-matrix-docker.sh",
18531855
"test:docker:plugin-update": "bash scripts/e2e/plugin-update-unchanged-docker.sh",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
title: Docker Compose setup evidence
2+
3+
scenario:
4+
id: compose-setup
5+
surface: docker-podman-hosting
6+
category: docker-podman-hosting.container-setup
7+
coverage:
8+
secondary:
9+
- docker.compose
10+
objective: Launch the documented Docker Compose topology from the package-backed functional image and record the exact package, image, and service container identities.
11+
successCriteria:
12+
- The scheduler builds the real package artifact and package-backed functional image through the canonical Docker planner.
13+
- "`docker compose up` starts the documented `openclaw-gateway` service with isolated state, config, workspace, and auth-profile mounts."
14+
- The Gateway reaches healthy state and the documented container-side health command passes.
15+
- "The `openclaw-cli` Compose service runs successfully in the Gateway network namespace."
16+
- Evidence records the package digest and version, functional image ID, and Gateway and CLI container IDs.
17+
docsRefs:
18+
- docs/install/docker.md
19+
- docs/help/testing.md
20+
codeRefs:
21+
- docker-compose.yml
22+
- scripts/e2e/compose-setup.sh
23+
- scripts/lib/docker-e2e-scenarios.mjs
24+
- scripts/package-openclaw-for-docker.mjs
25+
- test/e2e/qa-lab/runtime/docker-artifact-proof.ts
26+
execution:
27+
kind: script
28+
path: test/e2e/qa-lab/runtime/docker-artifact-proof.ts
29+
summary: Builds the package-backed functional image, launches the documented Compose services, validates health, and records artifact identities.
30+
timeoutMs: 1800000
31+
args:
32+
- --artifact-base
33+
- ${outputDir}
34+
- --lane
35+
- compose-setup

‎qa/scenarios/runtime/docker-compose-setup.yaml‎

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
title: Docker package install evidence
2+
3+
scenario:
4+
id: docker-package-install
5+
surface: docker-podman-hosting
6+
category: docker-podman-hosting.image-release-and-validation
7+
coverage:
8+
secondary:
9+
- docker.package-artifact-generation
10+
- cli.package-manager-installs
11+
objective: Build the real OpenClaw package artifact, install and execute it in the scheduler-selected bare container image, and record exact package, image, and container identities.
12+
successCriteria:
13+
- The canonical Docker package helper builds and validates the real npm tarball.
14+
- The scheduler prepares the package and bare target image through the shared planner and catalog.
15+
- A clean target container installs the tarball with npm and executes the installed OpenClaw CLI.
16+
- The installed package name and version match the tarball metadata.
17+
- Evidence records the package digest and version, bare image ID, target container ID, installed package root, and executed CLI version.
18+
docsRefs:
19+
- docs/install/updating.md
20+
- docs/help/testing.md
21+
- docs/concepts/qa-e2e-automation.md
22+
codeRefs:
23+
- scripts/package-openclaw-for-docker.mjs
24+
- scripts/e2e/docker-package-install.sh
25+
- scripts/lib/docker-e2e-scenarios.mjs
26+
- test/e2e/qa-lab/runtime/docker-artifact-proof.ts
27+
execution:
28+
kind: script
29+
path: test/e2e/qa-lab/runtime/docker-artifact-proof.ts
30+
summary: Builds the real package artifact, installs and executes it in a clean target container, and records artifact identities.
31+
timeoutMs: 1800000
32+
args:
33+
- --artifact-base
34+
- ${outputDir}
35+
- --lane
36+
- docker-package-install

‎qa/scenarios/runtime/package-openclaw-for-docker.yaml‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎scripts/e2e/compose-setup.sh‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
5+
source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh"
6+
7+
IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-docker-e2e-functional:local")"
8+
PACKAGE_TGZ="$(docker_e2e_prepare_package_tgz compose-setup "${OPENCLAW_CURRENT_PACKAGE_TGZ:-}")"
9+
IDENTITY_PATH="${OPENCLAW_DOCKER_ARTIFACT_IDENTITY_PATH:-$ROOT_DIR/.artifacts/docker-tests/compose-setup-identities.json}"
10+
PROJECT_DIR="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-compose-proof.XXXXXX")"
11+
PROJECT_NAME="openclaw-compose-proof-$$"
12+
CLI_NAME="$PROJECT_NAME-cli-proof"
13+
TOKEN="compose-proof-$$-$(date +%s)"
14+
COMPOSE=(docker compose --project-name "$PROJECT_NAME" --project-directory "$PROJECT_DIR" -f "$ROOT_DIR/docker-compose.yml")
15+
16+
cleanup() {
17+
docker_e2e_docker_cmd rm -f "$CLI_NAME" >/dev/null 2>&1 || true
18+
"${COMPOSE[@]}" down --remove-orphans --volumes >/dev/null 2>&1 || true
19+
docker_e2e_cleanup_package_tgz "$PACKAGE_TGZ"
20+
rm -rf "$PROJECT_DIR"
21+
}
22+
trap cleanup EXIT
23+
24+
mkdir -p "$PROJECT_DIR/config/workspace" "$PROJECT_DIR/auth-profile"
25+
chmod -R 0777 "$PROJECT_DIR/config" "$PROJECT_DIR/auth-profile"
26+
cat >"$PROJECT_DIR/config/openclaw.json" <<EOF
27+
{
28+
"gateway": {
29+
"mode": "local",
30+
"auth": { "mode": "token", "token": "$TOKEN" },
31+
"controlUi": { "enabled": false }
32+
}
33+
}
34+
EOF
35+
36+
export OPENCLAW_IMAGE="$IMAGE_NAME"
37+
export OPENCLAW_CONFIG_DIR="$PROJECT_DIR/config"
38+
export OPENCLAW_WORKSPACE_DIR="$PROJECT_DIR/config/workspace"
39+
export OPENCLAW_AUTH_PROFILE_SECRET_DIR="$PROJECT_DIR/auth-profile"
40+
export OPENCLAW_GATEWAY_TOKEN="$TOKEN"
41+
export OPENCLAW_GATEWAY_PORT=0
42+
export OPENCLAW_BRIDGE_PORT=0
43+
export OPENCLAW_MSTEAMS_PORT=0
44+
export OPENCLAW_DISABLE_BONJOUR=1
45+
export OPENCLAW_CURRENT_PACKAGE_TGZ="$PACKAGE_TGZ"
46+
47+
docker_e2e_build_or_reuse "$IMAGE_NAME" compose-setup "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR" functional
48+
49+
echo "Launching documented Docker Compose gateway topology..."
50+
"${COMPOSE[@]}" up -d --no-build openclaw-gateway
51+
GATEWAY_ID="$("${COMPOSE[@]}" ps -q openclaw-gateway)"
52+
if [ -z "$GATEWAY_ID" ]; then
53+
echo "Compose did not create openclaw-gateway" >&2
54+
exit 1
55+
fi
56+
57+
for _ in $(seq 1 180); do
58+
health="$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' "$GATEWAY_ID")"
59+
if [ "$health" = "healthy" ]; then
60+
break
61+
fi
62+
if [ "$health" = "unhealthy" ] || [ "$health" = "exited" ] || [ "$health" = "dead" ]; then
63+
"${COMPOSE[@]}" logs --no-color openclaw-gateway >&2
64+
exit 1
65+
fi
66+
sleep 1
67+
done
68+
if [ "$(docker inspect --format '{{.State.Health.Status}}' "$GATEWAY_ID")" != "healthy" ]; then
69+
"${COMPOSE[@]}" logs --no-color openclaw-gateway >&2
70+
echo "Compose gateway did not become healthy" >&2
71+
exit 1
72+
fi
73+
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"
76+
GATEWAY_VERSION="$("${COMPOSE[@]}" exec -T openclaw-gateway node -p "require('./package.json').version")"
77+
78+
node --import tsx "$ROOT_DIR/scripts/e2e/lib/docker-artifact-proof/write-identities.ts" \
79+
--scenario compose-setup \
80+
--output "$IDENTITY_PATH" \
81+
--image "$IMAGE_NAME" \
82+
--package "$PACKAGE_TGZ" \
83+
--container "gateway=$GATEWAY_ID" \
84+
--container "cli=$CLI_NAME" \
85+
--detail "gateway:openclawVersion=$GATEWAY_VERSION" \
86+
--detail "gateway:health=healthy" \
87+
--detail "cli:healthCommand=passed"
88+
89+
echo "Docker Compose setup proof passed."
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
5+
source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh"
6+
7+
IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-docker-e2e-bare:local")"
8+
PACKAGE_TGZ="$(docker_e2e_prepare_package_tgz docker-package-install "${OPENCLAW_CURRENT_PACKAGE_TGZ:-}")"
9+
IDENTITY_PATH="${OPENCLAW_DOCKER_ARTIFACT_IDENTITY_PATH:-$ROOT_DIR/.artifacts/docker-tests/docker-package-install-identities.json}"
10+
CONTAINER_NAME="openclaw-package-proof-$$"
11+
DOCKER_RUN_TIMEOUT="${OPENCLAW_DOCKER_PACKAGE_INSTALL_RUN_TIMEOUT:-120s}"
12+
13+
cleanup() {
14+
docker_e2e_docker_cmd rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true
15+
docker_e2e_cleanup_package_tgz "$PACKAGE_TGZ"
16+
}
17+
trap cleanup EXIT
18+
19+
docker_e2e_build_or_reuse "$IMAGE_NAME" docker-package-install "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR" bare
20+
21+
echo "Installing the real OpenClaw package artifact in the target container..."
22+
DOCKER_COMMAND_TIMEOUT="$DOCKER_RUN_TIMEOUT" docker_e2e_docker_run_cmd run -d \
23+
--name "$CONTAINER_NAME" \
24+
-v "$PACKAGE_TGZ:/tmp/openclaw-current.tgz:ro" \
25+
"$IMAGE_NAME" \
26+
bash -lc '
27+
set -euo pipefail
28+
npm install -g --prefix /tmp/openclaw-proof /tmp/openclaw-current.tgz --no-fund --no-audit
29+
package_root=/tmp/openclaw-proof/lib/node_modules/openclaw
30+
"$package_root/openclaw.mjs" --version > /tmp/openclaw-version
31+
"$package_root/openclaw.mjs" --help > /tmp/openclaw-help
32+
test -s /tmp/openclaw-help
33+
touch /tmp/openclaw-proof-ready
34+
exec sleep infinity
35+
' >/dev/null
36+
37+
for _ in $(seq 1 240); do
38+
if docker exec "$CONTAINER_NAME" test -f /tmp/openclaw-proof-ready; then
39+
break
40+
fi
41+
if [ "$(docker inspect --format '{{.State.Running}}' "$CONTAINER_NAME")" != "true" ]; then
42+
docker logs "$CONTAINER_NAME" >&2
43+
exit 1
44+
fi
45+
sleep 1
46+
done
47+
docker exec "$CONTAINER_NAME" test -f /tmp/openclaw-proof-ready
48+
49+
INSTALLED_VERSION="$(docker exec "$CONTAINER_NAME" cat /tmp/openclaw-version | tr -d '\r\n')"
50+
PACKAGE_ROOT="/tmp/openclaw-proof/lib/node_modules/openclaw"
51+
PACKAGE_VERSION="$(docker exec "$CONTAINER_NAME" node -p "require('$PACKAGE_ROOT/package.json').version")"
52+
if [[ "$INSTALLED_VERSION" != *"$PACKAGE_VERSION"* ]]; then
53+
echo "installed CLI output $INSTALLED_VERSION does not contain package version $PACKAGE_VERSION" >&2
54+
exit 1
55+
fi
56+
57+
node --import tsx "$ROOT_DIR/scripts/e2e/lib/docker-artifact-proof/write-identities.ts" \
58+
--scenario docker-package-install \
59+
--output "$IDENTITY_PATH" \
60+
--image "$IMAGE_NAME" \
61+
--package "$PACKAGE_TGZ" \
62+
--container "target=$CONTAINER_NAME" \
63+
--detail "target:installedPackageRoot=$PACKAGE_ROOT" \
64+
--detail "target:installedPackageVersion=$PACKAGE_VERSION" \
65+
--detail "target:openclawVersion=$INSTALLED_VERSION" \
66+
--detail "target:helpCommand=passed"
67+
68+
echo "Package artifact container proof passed."

0 commit comments

Comments
 (0)