Skip to content

Commit 426680c

Browse files
committed
test(qa): cover CLI distribution workflows
1 parent 3fa9cc2 commit 426680c

20 files changed

Lines changed: 608 additions & 49 deletions

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,7 @@
17821782
"test:docker:live-models:gemini": "OPENCLAW_LIVE_PROVIDERS=google-gemini-cli OPENCLAW_LIVE_MODELS=google-gemini-cli/gemini-3.1-pro-preview bash scripts/test-live-models-docker.sh",
17831783
"test:docker:live:all": "node scripts/run-with-env.mjs OPENCLAW_DOCKER_ALL_LIVE_MODE=only -- node scripts/test-docker-all.mjs",
17841784
"test:docker:local:all": "node scripts/run-with-env.mjs OPENCLAW_DOCKER_ALL_LIVE_MODE=skip -- node scripts/test-docker-all.mjs",
1785+
"test:docker:cli-installer-distribution": "bash scripts/e2e/cli-installer-distribution-docker.sh",
17851786
"test:docker:mcp-channels": "bash scripts/e2e/mcp-channels-docker.sh",
17861787
"test:docker:mcp-code-mode-gateway": "bash scripts/e2e/mcp-code-mode-gateway-docker.sh",
17871788
"test:docker:multi-node-update": "bash scripts/e2e/multi-node-update-docker.sh",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
title: CLI installer distribution
2+
3+
scenario:
4+
id: cli-installer-distribution
5+
surface: cli
6+
category: cli.cli-setup
7+
coverage:
8+
primary:
9+
- cli.local-prefix-install
10+
- cli.source-checkout-install
11+
secondary:
12+
- cli.installer-scripts
13+
objective: Verify the hosted installer installs an exact package candidate and the CLI installer builds an exact source checkout into a dedicated Node and OpenClaw prefix.
14+
successCriteria:
15+
- "`install.sh` validates the supported Node runtime, installs the exact package candidate, honors no-onboard mode, and exposes a PATH-resolved CLI."
16+
- "`install-cli.sh` provisions prefix-owned Node and an OpenClaw wrapper without using the system prefix."
17+
- The source checkout is pinned to the exact tested commit, builds successfully, and the wrapper targets its built entrypoint.
18+
- The installed source CLI serves help and version and reports git install kind through update status.
19+
docsRefs:
20+
- docs/install/index.md
21+
- docs/install/updating.md
22+
codeRefs:
23+
- scripts/install.sh
24+
- scripts/install-cli.sh
25+
- scripts/e2e/cli-installer-distribution-docker.sh
26+
execution:
27+
kind: script
28+
path: test/e2e/qa-lab/runtime/docker-e2e-lane.ts
29+
summary: Runs exact-candidate hosted-package and dedicated-prefix source-checkout installer proofs in clean Docker containers.
30+
timeoutMs: 1800000
31+
args:
32+
- --lane
33+
- cli-installer-distribution
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
title: CLI launcher runtime and recovery
2+
3+
scenario:
4+
id: cli-launcher-runtime
5+
surface: cli
6+
category: cli.cli-setup
7+
coverage:
8+
primary:
9+
- cli.cli-entrypoint
10+
- cli.supported-node-runtime
11+
objective: Verify the actual OpenClaw launcher accepts supported runtimes, rejects unsupported runtimes, serves help and version, and reports source-build recovery guidance.
12+
successCriteria:
13+
- The copied launcher executes under every supported Node minimum and future supported majors.
14+
- Below-floor and unsupported Node versions exit before loading the CLI with the documented runtime requirement.
15+
- "`--help` and `--version` execute through the launcher fast path."
16+
- A source checkout without built output reports the supported recovery command.
17+
docsRefs:
18+
- docs/install/index.md
19+
- docs/help/troubleshooting.md
20+
codeRefs:
21+
- openclaw.mjs
22+
- test/openclaw-launcher.e2e.test.ts
23+
execution:
24+
kind: vitest
25+
path: test/openclaw-launcher.e2e.test.ts
26+
summary: Executes copied launcher processes across supported and rejected runtime versions, CLI fast paths, and missing-build recovery.

‎qa/scenarios/runtime/docker-package-install.yaml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ scenario:
55
surface: containers
66
category: containers.image-release-and-validation
77
coverage:
8+
primary:
9+
- cli.package-manager-installs
810
secondary:
911
- containers.docker-e2e-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+
- cli.cli-entrypoint
13+
objective: Build the real OpenClaw package artifact, install it globally with npm, pnpm, and Bun in clean containers, execute each manager-created PATH entrypoint, and record exact identities.
1214
successCriteria:
1315
- The canonical Docker package helper builds and validates the real npm tarball.
1416
- 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.
17+
- Clean target containers install the same tarball globally with npm, pnpm, and Bun.
18+
- Each package manager creates a PATH-resolved OpenClaw executable that serves help and the candidate version.
19+
- Every installed package version matches the tarball metadata.
20+
- Evidence records the package digest and version, bare image ID, manager container IDs, package roots, executable paths, and CLI versions.
1821
docsRefs:
1922
- docs/install/updating.md
2023
- docs/help/testing.md
@@ -27,7 +30,7 @@ scenario:
2730
execution:
2831
kind: script
2932
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.
33+
summary: Builds one real package artifact, installs and executes it through npm, pnpm, and Bun PATH entrypoints in clean containers, and records artifact identities.
3134
timeoutMs: 1800000
3235
args:
3336
- --artifact-base

‎qa/scenarios/runtime/docker-update-channel-switch.yaml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ scenario:
77
coverage:
88
primary:
99
- cli.install-kind-switching
10-
- cli.update-status-and-rpc
11-
secondary:
1210
- cli.update-channels
13-
objective: Verify package-to-git and git-to-package update switching plus machine-readable update status in Docker.
11+
- cli.update-status-and-rpc
12+
objective: Verify stable, beta, and dev channel selection, package-to-git and git-to-package switching, and machine-readable update status in Docker.
1413
successCriteria:
14+
- The package install resolves the exact candidate through a hermetic beta dist-tag fixture, persists beta, and remains a package install.
1515
- The package install updates to a package-derived git dev fixture.
1616
- The git install updates back to the package tarball.
17-
- "`openclaw update status --json` reports the expected git and package status after each switch."
17+
- The beta, dev, and stable selections persist in canonical config.
18+
- "`openclaw update status --json` reports the expected package, git, and package status after each switch."
1819
docsRefs:
1920
- docs/cli/update.md
2021
- docs/install/updating.md
@@ -25,7 +26,7 @@ scenario:
2526
execution:
2627
kind: script
2728
path: test/e2e/qa-lab/runtime/docker-e2e-lane.ts
28-
summary: Runs the existing update-channel-switch Docker E2E lane and records QA Lab evidence for install-kind switching and update status coverage.
29+
summary: Runs stable, beta, and dev update selections through the existing Docker E2E lane and records install-kind, persisted-channel, and update-status evidence.
2930
args:
3031
- --lane
3132
- update-channel-switch

‎scripts/e2e/bun-global-install-smoke.sh‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,35 @@ NODE
177177
fi
178178

179179
echo "==> OpenClaw version through Bun global install"
180-
run_with_timeout "$COMMAND_TIMEOUT_MS" "$openclaw_bin" --version
180+
local openclaw_version
181+
openclaw_version="$(run_with_timeout "$COMMAND_TIMEOUT_MS" "$openclaw_bin" --version)"
182+
printf "%s\n" "$openclaw_version"
183+
184+
echo "==> OpenClaw help through Bun global install"
185+
run_with_timeout "$COMMAND_TIMEOUT_MS" "$openclaw_bin" --help >/dev/null
181186

182187
echo "==> OpenClaw image providers through Bun global install"
183188
local providers_json
184189
providers_json="$(run_with_timeout "$COMMAND_TIMEOUT_MS" "$openclaw_bin" infer image providers --json)"
185190
OPENCLAW_IMAGE_PROVIDERS_JSON="$providers_json" node scripts/e2e/lib/bun-global-install/assertions.mjs assert-image-providers
191+
192+
if [ -n "${OPENCLAW_BUN_GLOBAL_SMOKE_PROOF_PATH:-}" ]; then
193+
node --input-type=module - \
194+
"$OPENCLAW_BUN_GLOBAL_SMOKE_PROOF_PATH" \
195+
"$bun_path" \
196+
"$openclaw_bin" \
197+
"$openclaw_version" <<'NODE'
198+
import fs from "node:fs";
199+
import path from "node:path";
200+
201+
const [, , proofPath, bunPath, openclawPath, openclawVersion] = process.argv;
202+
fs.mkdirSync(path.dirname(proofPath), { recursive: true });
203+
fs.writeFileSync(
204+
proofPath,
205+
`${JSON.stringify({ bunPath, openclawPath, openclawVersion }, null, 2)}\n`,
206+
);
207+
NODE
208+
fi
186209
}
187210

188211
main "$@"
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/usr/bin/env bash
2+
# Proves hosted npm installation plus dedicated-prefix source installation.
3+
set -euo pipefail
4+
5+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
6+
source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh"
7+
8+
IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-cli-installer-distribution:local")"
9+
PACKAGE_TGZ="$(
10+
docker_e2e_prepare_package_tgz cli-installer-distribution "${OPENCLAW_CURRENT_PACKAGE_TGZ:-}"
11+
)"
12+
HOSTED_PROOF_CONTAINER="openclaw-hosted-installer-proof-$$"
13+
SOURCE_PROOF_CONTAINER="openclaw-source-installer-proof-$$"
14+
SOURCE_BUNDLE="$(mktemp "${TMPDIR:-/tmp}/openclaw-source.XXXXXX.bundle")"
15+
SOURCE_PROOF_SCRIPT="$(mktemp "${TMPDIR:-/tmp}/openclaw-source-proof.XXXXXX.sh")"
16+
SOURCE_SHA="$(git -C "$ROOT_DIR" rev-parse HEAD)"
17+
SOURCE_MEMORY="${OPENCLAW_CLI_INSTALLER_SOURCE_MEMORY:-16g}"
18+
19+
cleanup() {
20+
docker_e2e_docker_cmd rm -f \
21+
"$HOSTED_PROOF_CONTAINER" \
22+
"$SOURCE_PROOF_CONTAINER" >/dev/null 2>&1 || true
23+
docker_e2e_cleanup_package_tgz "$PACKAGE_TGZ"
24+
rm -f "$SOURCE_BUNDLE" "$SOURCE_PROOF_SCRIPT"
25+
}
26+
trap cleanup EXIT
27+
28+
git -C "$ROOT_DIR" bundle create "$SOURCE_BUNDLE" HEAD
29+
cat >"$SOURCE_PROOF_SCRIPT" <<'SOURCE_PROOF'
30+
#!/usr/bin/env bash
31+
set -euo pipefail
32+
33+
test -r "$0"
34+
test -x "$0"
35+
command -v curl >/dev/null
36+
git clone -q /tmp/openclaw-source.bundle /tmp/openclaw-source
37+
git -C /tmp/openclaw-source checkout -q --detach "$OPENCLAW_SOURCE_SHA"
38+
bash /tmp/openclaw-source/scripts/install-cli.sh \
39+
--install-method git \
40+
--git-dir /tmp/openclaw-source \
41+
--version "$OPENCLAW_SOURCE_SHA" \
42+
--no-git-update \
43+
--prefix /tmp/openclaw-prefix \
44+
--node-version 24.15.0 \
45+
--no-onboard
46+
47+
prefix_node=/tmp/openclaw-prefix/tools/node/bin/node
48+
prefix_cli=/tmp/openclaw-prefix/bin/openclaw
49+
test -x "$prefix_node"
50+
test -x "$prefix_cli"
51+
grep -Fq "exec \"$prefix_node\"" "$prefix_cli"
52+
grep -Fq "/tmp/openclaw-source/dist/entry.js" "$prefix_cli"
53+
export PATH="/tmp/openclaw-prefix/bin:$PATH"
54+
test "$(command -v openclaw)" = "$prefix_cli"
55+
test "$(git -C /tmp/openclaw-source rev-parse HEAD)" = "$OPENCLAW_SOURCE_SHA"
56+
openclaw_version="$(openclaw --version)"
57+
openclaw --help >/tmp/openclaw-help
58+
test -s /tmp/openclaw-help
59+
status_json="$(openclaw update status --json)"
60+
STATUS_JSON="$status_json" node -e "
61+
const status = JSON.parse(process.env.STATUS_JSON);
62+
if (status.update?.installKind !== \"git\") {
63+
throw new Error(\`expected git install kind, got \${status.update?.installKind}\`);
64+
}
65+
"
66+
printf "prefixNode=%s@%s\n" "$prefix_node" "$("$prefix_node" --version)"
67+
printf "prefixOpenClaw=%s@%s\n" "$prefix_cli" "$openclaw_version"
68+
printf "sourceHead=%s installKind=git\n" "$OPENCLAW_SOURCE_SHA"
69+
printf "sourceOnboard=disabled\n"
70+
touch /tmp/openclaw-proof-ready
71+
exec sleep infinity
72+
SOURCE_PROOF
73+
chmod 0555 "$SOURCE_PROOF_SCRIPT"
74+
75+
docker_e2e_build_or_reuse \
76+
"$IMAGE_NAME" \
77+
cli-installer-distribution \
78+
"$ROOT_DIR/scripts/e2e/Dockerfile" \
79+
"$ROOT_DIR" \
80+
bare
81+
82+
echo "==> Hosted install.sh exact-candidate proof"
83+
docker_e2e_docker_run_cmd run -d \
84+
--name "$HOSTED_PROOF_CONTAINER" \
85+
-e HOME=/tmp/openclaw-hosted-home \
86+
-e OPENCLAW_NO_ONBOARD=1 \
87+
-e OPENCLAW_NO_PROMPT=1 \
88+
-v "$PACKAGE_TGZ:/tmp/openclaw-current.tgz:ro" \
89+
-v "$ROOT_DIR/scripts/install.sh:/tmp/install.sh:ro" \
90+
"$IMAGE_NAME" \
91+
bash -lc '
92+
set -euo pipefail
93+
mkdir -p "$HOME"
94+
bash /tmp/install.sh \
95+
--install-method npm \
96+
--version file:/tmp/openclaw-current.tgz \
97+
--no-onboard \
98+
--no-prompt
99+
source "$HOME/.bashrc"
100+
hash -r
101+
openclaw_path="$(command -v openclaw)"
102+
test -n "$openclaw_path"
103+
node_path="$(command -v node)"
104+
node_version="$(node --version)"
105+
openclaw_version="$(openclaw --version)"
106+
openclaw --help >/tmp/openclaw-help
107+
test -s /tmp/openclaw-help
108+
printf "hostedNode=%s@%s\n" "$node_path" "$node_version"
109+
printf "hostedOpenClaw=%s@%s\n" "$openclaw_path" "$openclaw_version"
110+
printf "hostedOnboard=disabled\n"
111+
touch /tmp/openclaw-proof-ready
112+
exec sleep infinity
113+
' >/dev/null
114+
115+
# A full source install builds every workspace package; the shared 8g cap OOMs before wrapper creation.
116+
echo "==> install-cli.sh dedicated-prefix source-checkout proof"
117+
docker_e2e_docker_run_cmd run -d \
118+
--name "$SOURCE_PROOF_CONTAINER" \
119+
--memory "$SOURCE_MEMORY" \
120+
-e HOME=/tmp/openclaw-source-home \
121+
-e OPENCLAW_NO_ONBOARD=1 \
122+
-e OPENCLAW_NO_PROMPT=1 \
123+
-e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
124+
-e "OPENCLAW_SOURCE_SHA=$SOURCE_SHA" \
125+
--user root \
126+
-v "$SOURCE_BUNDLE:/tmp/openclaw-source.bundle:ro" \
127+
-v "$SOURCE_PROOF_SCRIPT:/tmp/source-proof.sh:ro" \
128+
"$IMAGE_NAME" \
129+
bash -lc '
130+
set -euo pipefail
131+
apt-get update
132+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl
133+
rm -rf /var/lib/apt/lists/*
134+
command -v curl >/dev/null
135+
install -d -o appuser -g appuser "$HOME"
136+
exec runuser -u appuser -- env \
137+
HOME="$HOME" \
138+
OPENCLAW_NO_ONBOARD="$OPENCLAW_NO_ONBOARD" \
139+
OPENCLAW_NO_PROMPT="$OPENCLAW_NO_PROMPT" \
140+
COREPACK_ENABLE_DOWNLOAD_PROMPT="$COREPACK_ENABLE_DOWNLOAD_PROMPT" \
141+
OPENCLAW_SOURCE_SHA="$OPENCLAW_SOURCE_SHA" \
142+
bash /tmp/source-proof.sh
143+
' >/dev/null
144+
145+
wait_for_proof() {
146+
local container_name="$1"
147+
for _ in $(seq 1 1200); do
148+
if docker exec "$container_name" test -f /tmp/openclaw-proof-ready; then
149+
docker logs "$container_name"
150+
return 0
151+
fi
152+
if [ "$(docker inspect --format '{{.State.Running}}' "$container_name")" != "true" ]; then
153+
docker logs "$container_name" >&2
154+
return 1
155+
fi
156+
sleep 1
157+
done
158+
docker logs "$container_name" >&2
159+
return 1
160+
}
161+
162+
wait_for_proof "$HOSTED_PROOF_CONTAINER"
163+
wait_for_proof "$SOURCE_PROOF_CONTAINER"
164+
echo "CLI installer distribution proof passed."

0 commit comments

Comments
 (0)