Skip to content

Commit 769d598

Browse files
rootroot
authored andcommitted
fix(test): align Dockerfile tests with new base-runtime format
- Replace exact FROM base-runtime matches with FROM ${OPENCLAW_NODE_BOOKWORM_SLIM_IMAGE} AS base-runtime - Replace apt-get install xvfb assertion with install_list pattern - Fix export of assertBaseSnapshotStillCurrent in io.ts - All 90 tests passing across 3 test files
1 parent 5b94287 commit 769d598

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎src/config/io.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ function hashConfigRaw(raw: string | null): string {
299299
return crypto.createHash("sha256").update(raw).digest("hex");
300300
}
301301

302-
async function assertBaseSnapshotStillCurrent(
302+
export async function assertBaseSnapshotStillCurrent(
303303
snapshot: ConfigFileSnapshot,
304304
configPath: string,
305305
ioFs: typeof fs,

‎src/dockerfile.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe("Dockerfile", () => {
4040
expect(dockerfile).toContain("FROM ${OPENCLAW_NODE_BOOKWORM_IMAGE} AS workspace-deps");
4141
expect(dockerfile).toContain("FROM ${OPENCLAW_NODE_BOOKWORM_IMAGE} AS build");
4242
expect(dockerfile).toContain("FROM ${OPENCLAW_NODE_BOOKWORM_SLIM_IMAGE} AS base-runtime");
43-
expect(dockerfile).toContain("FROM base-runtime");
4443
expect(dockerfile).toContain("current multi-arch manifest list entries");
4544
expect(dockerfile).not.toContain("current amd64 entry");
4645
expect(dockerfile).not.toContain("OPENCLAW_VARIANT");
@@ -92,7 +91,7 @@ describe("Dockerfile", () => {
9291
expect(dockerfile).toContain(
9392
"node /app/node_modules/playwright-core/cli.js install --with-deps chromium",
9493
);
95-
expect(dockerfile).toContain("apt-get install -y --no-install-recommends xvfb");
94+
expect(dockerfile).toContain('install_list="$install_list xvfb"');
9695
});
9796

9897
it("uses the Docker target platform for pnpm install and prune", async () => {
@@ -288,7 +287,9 @@ describe("Dockerfile", () => {
288287

289288
it("keeps runtime workspace templates in final images", async () => {
290289
const dockerfile = await readFile(dockerfilePath, "utf8");
291-
const runtimeStageIndex = dockerfile.lastIndexOf("FROM base-runtime");
290+
const runtimeStageIndex = dockerfile.lastIndexOf(
291+
"FROM ${OPENCLAW_NODE_BOOKWORM_SLIM_IMAGE} AS base-runtime",
292+
);
292293
const templatesCopyIndex = dockerfile.indexOf(
293294
"COPY --from=runtime-assets --chown=node:node /app/src/agents/templates ./src/agents/templates",
294295
runtimeStageIndex,
@@ -451,7 +452,9 @@ describe("Dockerfile", () => {
451452

452453
it("pre-creates named-volume mount points before switching to the node user", async () => {
453454
const dockerfile = await readFile(dockerfilePath, "utf8");
454-
const runtimeStageIndex = dockerfile.lastIndexOf("FROM base-runtime");
455+
const runtimeStageIndex = dockerfile.lastIndexOf(
456+
"FROM ${OPENCLAW_NODE_BOOKWORM_SLIM_IMAGE} AS base-runtime",
457+
);
455458
const parentConfigDirIndex = dockerfile.indexOf(
456459
"RUN install -d -m 0755 -o node -g node /home/node/.config",
457460
runtimeStageIndex,

0 commit comments

Comments
 (0)