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