Skip to content

Commit 74b2453

Browse files
authored
Add support for running in parallel for distinct UIDs (#1276)
1 parent a6c5358 commit 74b2453

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/testcontainers/src/reaper/reaper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ContainerInfo } from "dockerode";
22
import { Socket } from "net";
3+
import { userInfo } from "os";
34
import { IntervalRetry, log, RandomUuid, withFileLock } from "../common";
45
import { ContainerRuntimeClient, ImageName } from "../container-runtime";
56
import { GenericContainer } from "../generic-container/generic-container";
@@ -28,7 +29,8 @@ export async function getReaper(client: ContainerRuntimeClient): Promise<Reaper>
2829
return reaper;
2930
}
3031

31-
reaper = await withFileLock("testcontainers-node.lock", async () => {
32+
const userId = userInfo().uid;
33+
reaper = await withFileLock(`testcontainers-node-${userId}.lock`, async () => {
3234
const reaperContainers = await findReaperContainers(client);
3335

3436
if (process.env.TESTCONTAINERS_RYUK_DISABLED === "true") {

0 commit comments

Comments
 (0)