Skip to content

Commit 839892e

Browse files
committed
test(agents): track local service temp directories
1 parent e413d36 commit 839892e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/agents/provider-local-service.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import path from "node:path";
77
import { MAX_TIMER_TIMEOUT_MS } from "@openclaw/normalization-core/number-coercion";
88
import type { Model } from "openclaw/plugin-sdk/llm";
99
import { afterEach, describe, expect, it, vi } from "vitest";
10+
import { useAutoCleanupTempDirTracker } from "../../test/helpers/temp-dir.js";
1011
import { mintSecretSentinel } from "../secrets/sentinel.js";
1112
import { killPidIfAlive, readPidFile, waitForPidToExit } from "../test-utils/process-tree.js";
1213
import {
@@ -59,6 +60,8 @@ async function waitForProbeFailure(url: string): Promise<void> {
5960
}
6061

6162
describe("provider local service", () => {
63+
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
64+
6265
afterEach(() => {
6366
stopManagedProviderLocalServicesForTest();
6467
});
@@ -481,7 +484,7 @@ describe("provider local service", () => {
481484

482485
it("does not keep one-shot hosts alive through diagnostic pipes", async () => {
483486
const port = await freePort();
484-
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-local-service-unref-"));
487+
const tempDir = tempDirs.make("openclaw-local-service-unref-");
485488
const servicePidPath = path.join(tempDir, "service.pid");
486489
const moduleUrl = new URL("./provider-local-service.ts", import.meta.url).href;
487490
const script = [
@@ -538,7 +541,6 @@ describe("provider local service", () => {
538541
servicePid = await readPidFile(servicePidPath).catch(() => undefined);
539542
}
540543
killPidIfAlive(servicePid);
541-
await fs.rm(tempDir, { force: true, recursive: true });
542544
}
543545
});
544546

0 commit comments

Comments
 (0)