mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:10:43 +00:00
test: add Crestodian QA lab setup scenario
This commit is contained in:
@@ -103,6 +103,48 @@ describe("qa suite runtime agent process helpers", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("merges isolated env overrides into qa cli runs", async () => {
|
||||
const child = createSpawnedProcess();
|
||||
spawnMock.mockReturnValue(child);
|
||||
|
||||
const pending = runQaCli(
|
||||
{
|
||||
repoRoot: "/repo",
|
||||
gateway: {
|
||||
tempRoot: "/tmp/runtime",
|
||||
runtimeEnv: { PATH: "/usr/bin", OPENCLAW_STATE_DIR: "/tmp/default-state" },
|
||||
},
|
||||
primaryModel: "openai/gpt-5.4",
|
||||
alternateModel: "openai/gpt-5.4-mini",
|
||||
providerMode: "mock-openai",
|
||||
} as never,
|
||||
["crestodian", "-m", "overview"],
|
||||
{
|
||||
env: {
|
||||
OPENCLAW_STATE_DIR: "/tmp/isolated-state",
|
||||
OPENCLAW_CONFIG_PATH: "/tmp/isolated-state/openclaw.json",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
await waitForSpawnCount(1);
|
||||
child.stdout.emit("data", Buffer.from("ok\n"));
|
||||
child.emit("exit", 0);
|
||||
|
||||
await expect(pending).resolves.toBe("ok");
|
||||
expect(spawnMock).toHaveBeenCalledWith(
|
||||
"/usr/bin/node",
|
||||
["/repo/dist/index.js", "crestodian", "-m", "overview"],
|
||||
expect.objectContaining({
|
||||
env: expect.objectContaining({
|
||||
PATH: "/usr/bin",
|
||||
OPENCLAW_STATE_DIR: "/tmp/isolated-state",
|
||||
OPENCLAW_CONFIG_PATH: "/tmp/isolated-state/openclaw.json",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("parses json qa cli output when requested", async () => {
|
||||
const child = createSpawnedProcess();
|
||||
spawnMock.mockReturnValue(child);
|
||||
|
||||
@@ -73,7 +73,7 @@ async function runQaCli(
|
||||
"gateway" | "repoRoot" | "primaryModel" | "alternateModel" | "providerMode"
|
||||
>,
|
||||
args: string[],
|
||||
opts?: { timeoutMs?: number; json?: boolean },
|
||||
opts?: { timeoutMs?: number; json?: boolean; env?: NodeJS.ProcessEnv },
|
||||
) {
|
||||
const stdout: Buffer[] = [];
|
||||
const stderr: Buffer[] = [];
|
||||
@@ -82,7 +82,10 @@ async function runQaCli(
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const child = spawn(nodeExecPath, [distEntryPath, ...args], {
|
||||
cwd: env.gateway.tempRoot,
|
||||
env: env.gateway.runtimeEnv,
|
||||
env: {
|
||||
...env.gateway.runtimeEnv,
|
||||
...opts?.env,
|
||||
},
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
const timeout = setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user