Skip to content

Commit bcea5e7

Browse files
committed
test: harden Docker E2E readiness
1 parent 7ac35b4 commit bcea5e7

5 files changed

Lines changed: 47 additions & 32 deletions

File tree

‎docs/help/testing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ The live-model Docker runners also bind-mount only the needed CLI auth homes (or
516516
- Gateway + dev agent: `pnpm test:docker:live-gateway` (script: `scripts/test-live-gateway-models-docker.sh`)
517517
- Open WebUI live smoke: `pnpm test:docker:openwebui` (script: `scripts/e2e/openwebui-docker.sh`)
518518
- Onboarding wizard (TTY, full scaffolding): `pnpm test:docker:onboard` (script: `scripts/e2e/onboard-docker.sh`)
519-
- Npm tarball onboarding/channel/agent smoke: `pnpm test:docker:npm-onboard-channel-agent` installs the packed OpenClaw tarball globally in Docker, configures OpenAI via env-ref onboarding plus Telegram by default, verifies enabling the plugin installs its runtime deps on demand, runs doctor, and runs one mocked OpenAI agent turn. Reuse a prebuilt tarball with `OPENCLAW_NPM_ONBOARD_PACKAGE_TGZ=/path/to/openclaw-*.tgz`, skip the host rebuild with `OPENCLAW_NPM_ONBOARD_HOST_BUILD=0`, or switch channel with `OPENCLAW_NPM_ONBOARD_CHANNEL=discord`.
519+
- Npm tarball onboarding/channel/agent smoke: `pnpm test:docker:npm-onboard-channel-agent` installs the packed OpenClaw tarball globally in Docker, configures OpenAI via env-ref onboarding plus Telegram by default, verifies doctor repairs activated plugin runtime deps, and runs one mocked OpenAI agent turn. Reuse a prebuilt tarball with `OPENCLAW_NPM_ONBOARD_PACKAGE_TGZ=/path/to/openclaw-*.tgz`, skip the host rebuild with `OPENCLAW_NPM_ONBOARD_HOST_BUILD=0`, or switch channel with `OPENCLAW_NPM_ONBOARD_CHANNEL=discord`.
520520
- Bun global install smoke: `bash scripts/e2e/bun-global-install-smoke.sh` packs the current tree, installs it with `bun install -g` in an isolated home, and verifies `openclaw infer image providers --json` returns bundled image providers instead of hanging. Reuse a prebuilt tarball with `OPENCLAW_BUN_GLOBAL_SMOKE_PACKAGE_TGZ=/path/to/openclaw-*.tgz`, skip the host build with `OPENCLAW_BUN_GLOBAL_SMOKE_HOST_BUILD=0`, or copy `dist/` from a built Docker image with `OPENCLAW_BUN_GLOBAL_SMOKE_DIST_IMAGE=openclaw-dockerfile-smoke:local`.
521521
- Installer Docker smoke: `bash scripts/test-install-sh-docker.sh` shares one npm cache across its root, update, and direct-npm containers. Update smoke defaults to npm `latest` as the stable baseline before upgrading to the candidate tarball. Non-root installer checks keep an isolated npm cache so root-owned cache entries do not mask user-local install behavior. Set `OPENCLAW_INSTALL_SMOKE_NPM_CACHE_DIR=/path/to/cache` to reuse the root/update/direct-npm cache across local reruns.
522522
- Install Smoke CI skips the duplicate direct-npm global update with `OPENCLAW_INSTALL_SMOKE_SKIP_NPM_GLOBAL=1`; run the script locally without that env when direct `npm install -g` coverage is needed.

‎scripts/e2e/cron-mcp-cleanup-docker-client.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async function runCronCleanupScenario(params: {
131131
payload: {
132132
kind: "agentTurn",
133133
message: "Use available context and then stop.",
134-
timeoutSeconds: 12,
134+
timeoutSeconds: 90,
135135
lightContext: true,
136136
},
137137
delivery: { mode: "none" },
@@ -182,7 +182,7 @@ async function runCronCleanupScenario(params: {
182182
entry.payload.jobId === job.id &&
183183
entry.payload.action === "finished",
184184
)?.payload,
185-
90_000,
185+
150_000,
186186
);
187187
assert(finished, "missing cron finished event");
188188

@@ -212,7 +212,7 @@ async function runSubagentCleanupScenario(params: {
212212
cleanupBundleMcpOnRunEnd: true,
213213
idempotencyKey: randomUUID(),
214214
deliver: false,
215-
timeout: 20,
215+
timeout: 90,
216216
bestEffortDeliver: true,
217217
});
218218
assert(

‎scripts/e2e/mcp-channels-docker-client.ts‎

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,21 @@ async function main() {
3434
mcp = mcpHandle.client;
3535
}
3636

37-
const listed = (await mcp.callTool({
38-
name: "conversations_list",
39-
arguments: {},
40-
})) as {
41-
structuredContent?: { conversations?: Array<Record<string, unknown>> };
42-
};
43-
const conversation = listed.structuredContent?.conversations?.find(
44-
(entry) => entry.sessionKey === "agent:main:main",
37+
const conversation = await waitFor(
38+
"seeded conversation in conversations_list",
39+
async () => {
40+
const listed = (await mcp.callTool({
41+
name: "conversations_list",
42+
arguments: {},
43+
})) as {
44+
structuredContent?: { conversations?: Array<Record<string, unknown>> };
45+
};
46+
return listed.structuredContent?.conversations?.find(
47+
(entry) => entry.sessionKey === "agent:main:main",
48+
);
49+
},
50+
240_000,
4551
);
46-
assert(conversation, "expected seeded conversation in conversations_list");
4752
assert(conversation.channel === "imessage", "expected seeded channel");
4853
assert(conversation.to === "+15551234567", "expected seeded target");
4954

@@ -60,19 +65,31 @@ async function main() {
6065
"conversation_get returned wrong session",
6166
);
6267

63-
const history = (await mcp.callTool({
64-
name: "messages_read",
65-
arguments: { session_key: "agent:main:main", limit: 10 },
66-
})) as {
67-
structuredContent?: { messages?: Array<Record<string, unknown>> };
68-
};
69-
const messages = history.structuredContent?.messages ?? [];
70-
assert(messages.length >= 2, "expected seeded transcript messages");
71-
const attachmentMessage = messages.find((entry) => {
72-
const raw = entry.__openclaw;
73-
return raw && typeof raw === "object" && (raw as { id?: unknown }).id === "msg-attachment";
74-
});
75-
assert(attachmentMessage, "expected seeded attachment message");
68+
const messages = await waitFor(
69+
"seeded transcript messages",
70+
async () => {
71+
const history = (await mcp.callTool({
72+
name: "messages_read",
73+
arguments: { session_key: "agent:main:main", limit: 10 },
74+
})) as {
75+
structuredContent?: { messages?: Array<Record<string, unknown>> };
76+
};
77+
const currentMessages = history.structuredContent?.messages ?? [];
78+
return currentMessages.length >= 2 ? currentMessages : undefined;
79+
},
80+
240_000,
81+
);
82+
await waitFor(
83+
"seeded attachment message",
84+
() =>
85+
messages.find((entry) => {
86+
const raw = entry.__openclaw;
87+
return (
88+
raw && typeof raw === "object" && (raw as { id?: unknown }).id === "msg-attachment"
89+
);
90+
}),
91+
240_000,
92+
);
7693

7794
const attachments = (await mcp.callTool({
7895
name: "attachments_fetch",

‎scripts/e2e/mcp-channels-harness.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ export function extractTextFromGatewayPayload(
7474

7575
export async function waitFor<T>(
7676
label: string,
77-
predicate: () => T | undefined,
77+
predicate: () => Promise<T | undefined> | T | undefined,
7878
timeoutMs = 10_000,
7979
): Promise<T> {
8080
const started = Date.now();
8181
while (Date.now() - started < timeoutMs) {
82-
const value = predicate();
82+
const value = await predicate();
8383
if (value !== undefined) {
8484
return value;
8585
}

‎scripts/e2e/npm-onboard-channel-agent-docker.sh‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,8 @@ if (!serialized.includes(token)) {
432432
}
433433
NODE
434434
435-
assert_dep_present "$DEP_SENTINEL"
436-
437-
echo "Running doctor after activated plugin dep install..."
438-
openclaw doctor --non-interactive >/tmp/openclaw-doctor.log 2>&1
435+
echo "Running doctor after channel activation..."
436+
openclaw doctor --repair --non-interactive >/tmp/openclaw-doctor.log 2>&1
439437
assert_dep_present "$DEP_SENTINEL"
440438
441439
echo "Running local agent turn against mocked OpenAI..."

0 commit comments

Comments
 (0)