mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03:00
perf(test): speed up docker-setup suite
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { spawnSync } from "node:child_process";
|
import { spawnSync } from "node:child_process";
|
||||||
import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
import { chmod, copyFile, mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
@@ -46,8 +46,8 @@ async function createDockerSetupSandbox(): Promise<DockerSetupSandbox> {
|
|||||||
const binDir = join(rootDir, "bin");
|
const binDir = join(rootDir, "bin");
|
||||||
const logPath = join(rootDir, "docker-stub.log");
|
const logPath = join(rootDir, "docker-stub.log");
|
||||||
|
|
||||||
const script = await readFile(join(repoRoot, "docker-setup.sh"), "utf8");
|
await copyFile(join(repoRoot, "docker-setup.sh"), scriptPath);
|
||||||
await writeFile(scriptPath, script, { mode: 0o755 });
|
await chmod(scriptPath, 0o755);
|
||||||
await writeFile(dockerfilePath, "FROM scratch\n");
|
await writeFile(dockerfilePath, "FROM scratch\n");
|
||||||
await writeFile(
|
await writeFile(
|
||||||
composePath,
|
composePath,
|
||||||
@@ -95,7 +95,7 @@ describe("docker-setup.sh", () => {
|
|||||||
OPENCLAW_EXTRA_MOUNTS: undefined,
|
OPENCLAW_EXTRA_MOUNTS: undefined,
|
||||||
OPENCLAW_HOME_VOLUME: undefined,
|
OPENCLAW_HOME_VOLUME: undefined,
|
||||||
}),
|
}),
|
||||||
encoding: "utf8",
|
stdio: ["ignore", "ignore", "pipe"],
|
||||||
});
|
});
|
||||||
expect(defaultsResult.status).toBe(0);
|
expect(defaultsResult.status).toBe(0);
|
||||||
const defaultsEnvFile = await readFile(join(sandbox.rootDir, ".env"), "utf8");
|
const defaultsEnvFile = await readFile(join(sandbox.rootDir, ".env"), "utf8");
|
||||||
@@ -111,7 +111,7 @@ describe("docker-setup.sh", () => {
|
|||||||
OPENCLAW_EXTRA_MOUNTS: "",
|
OPENCLAW_EXTRA_MOUNTS: "",
|
||||||
OPENCLAW_HOME_VOLUME: "openclaw-home",
|
OPENCLAW_HOME_VOLUME: "openclaw-home",
|
||||||
}),
|
}),
|
||||||
encoding: "utf8",
|
stdio: ["ignore", "ignore", "pipe"],
|
||||||
});
|
});
|
||||||
expect(aptAndHomeVolumeResult.status).toBe(0);
|
expect(aptAndHomeVolumeResult.status).toBe(0);
|
||||||
const aptEnvFile = await readFile(join(sandbox.rootDir, ".env"), "utf8");
|
const aptEnvFile = await readFile(join(sandbox.rootDir, ".env"), "utf8");
|
||||||
|
|||||||
Reference in New Issue
Block a user