Skip to content

Fix testcontainers cleanup #2023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ jobs:
name: "🧪 Unit Tests"
runs-on: ubuntu-latest
steps:
- name: 🔧 Disable IPv6
run: |
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

- name: 🔧 Configure docker address pool
run: |
CONFIG='{
"default-address-pools" : [
{
"base" : "172.17.0.0/12",
"size" : 20
},
{
"base" : "192.168.0.0/16",
"size" : 24
}
]
}'
mkdir -p /etc/docker
echo "$CONFIG" | sudo tee /etc/docker/daemon.json

- name: 🔧 Restart docker daemon
run: sudo systemctl restart docker

- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions apps/webapp/tsconfig.check.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "DOM.AsyncIterable", "ES2022"],
"target": "ES2022",
"noEmit": true,
"paths": {
"~/*": ["./app/*"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe("RunEngine attempt failures", () => {
expect(executionData4.run.attemptNumber).toBe(2);
expect(executionData4.run.status).toBe("COMPLETED_SUCCESSFULLY");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -266,7 +266,7 @@ describe("RunEngine attempt failures", () => {
expect(executionData3.run.attemptNumber).toBe(1);
expect(executionData3.run.status).toBe("COMPLETED_WITH_ERRORS");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -375,7 +375,7 @@ describe("RunEngine attempt failures", () => {
expect(executionData3.run.attemptNumber).toBe(1);
expect(executionData3.run.status).toBe("CRASHED");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -482,7 +482,7 @@ describe("RunEngine attempt failures", () => {
expect(executionData.run.attemptNumber).toBe(1);
expect(executionData.run.status).toBe("CRASHED");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -639,7 +639,7 @@ describe("RunEngine attempt failures", () => {
expect(executionData4.run.attemptNumber).toBe(2);
expect(executionData4.run.status).toBe("COMPLETED_SUCCESSFULLY");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -803,7 +803,7 @@ describe("RunEngine attempt failures", () => {
expect(finalExecutionData.run.attemptNumber).toBe(2);
expect(finalExecutionData.run.status).toBe("CRASHED");
} finally {
engine.quit();
await engine.quit();
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe("RunEngine batchTrigger", () => {
});
expect(batchAfter2?.status).toBe("COMPLETED");
} finally {
engine.quit();
await engine.quit();
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ describe("RunEngine batchTriggerAndWait", () => {
});
expect(batchAfter?.status === "COMPLETED");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -570,7 +570,7 @@ describe("RunEngine batchTriggerAndWait", () => {
);
expect(parentAfterTriggerAndWait.batch).toBeUndefined();
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe("RunEngine cancelling", () => {
);
expect(envConcurrencyCompleted).toBe(0);
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down Expand Up @@ -321,7 +321,7 @@ describe("RunEngine cancelling", () => {
);
expect(envConcurrencyCompleted).toBe(0);
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ describe("RunEngine checkpoints", () => {
});
expect(batchAfter?.status === "COMPLETED");
} finally {
engine.quit();
await engine.quit();
}
});
});
8 changes: 4 additions & 4 deletions internal-packages/run-engine/src/engine/tests/delays.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("RunEngine delays", () => {
assertNonNullable(executionData2);
expect(executionData2.snapshot.executionStatus).toBe("QUEUED");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -183,7 +183,7 @@ describe("RunEngine delays", () => {
assertNonNullable(executionData3);
expect(executionData3.snapshot.executionStatus).toBe("QUEUED");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -287,7 +287,7 @@ describe("RunEngine delays", () => {

expect(run3.status).toBe("EXPIRED");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -398,7 +398,7 @@ describe("RunEngine delays", () => {
expect(executionData4.snapshot.executionStatus).toBe("FINISHED");
expect(executionData4.run.status).toBe("CANCELED");
} finally {
engine.quit();
await engine.quit();
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe("RunEngine dequeuing", () => {

expect(dequeued.length).toBe(5);
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -169,7 +169,7 @@ describe("RunEngine dequeuing", () => {
const queueLength3 = await engine.runQueue.lengthOfEnvQueue(authenticatedEnvironment);
expect(queueLength3).toBe(12);
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe("RunEngine pending version", () => {
);
expect(queueLength2).toBe(2);
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down Expand Up @@ -319,7 +319,7 @@ describe("RunEngine pending version", () => {
);
expect(queueLength3).toBe(1);
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe("RunEngine priority", () => {
expect(dequeue2.length).toBe(1);
expect(dequeue2[0].run.friendlyId).toBe(runs[2].friendlyId);
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down Expand Up @@ -197,7 +197,7 @@ describe("RunEngine priority", () => {
expect(dequeue[3].run.friendlyId).toBe(runs[4].friendlyId);
expect(dequeue[4].run.friendlyId).toBe(runs[0].friendlyId);
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down
4 changes: 2 additions & 2 deletions internal-packages/run-engine/src/engine/tests/trigger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe("RunEngine trigger()", () => {
expect(runWaitpointAfter[0].type).toBe("RUN");
expect(runWaitpointAfter[0].output).toBe(`{"foo":"bar"}`);
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -325,7 +325,7 @@ describe("RunEngine trigger()", () => {
expect(output.type).toBe(error.type);
expect(runWaitpointAfter[0].outputIsError).toBe(true);
} finally {
engine.quit();
await engine.quit();
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ describe("RunEngine triggerAndWait", () => {
);
expect(parentExecutionDataAfter.completedWaitpoints![0].output).toBe('{"foo":"bar"}');
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -445,7 +445,7 @@ describe("RunEngine triggerAndWait", () => {
);
expect(parent2ExecutionDataAfter.completedWaitpoints![0].output).toBe('{"foo":"bar"}');
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion internal-packages/run-engine/src/engine/tests/ttl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe("RunEngine ttl", () => {
);
expect(envConcurrencyCompleted).toBe(0);
} finally {
engine.quit();
await engine.quit();
}
});
});
16 changes: 8 additions & 8 deletions internal-packages/run-engine/src/engine/tests/waitpoints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe("RunEngine Waitpoints", () => {
const executionDataAfter = await engine.getRunExecutionData({ runId: run.id });
expect(executionDataAfter?.snapshot.executionStatus).toBe("EXECUTING");
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -261,7 +261,7 @@ describe("RunEngine Waitpoints", () => {
});
expect(runWaitpoint).toBeNull();
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -400,7 +400,7 @@ describe("RunEngine Waitpoints", () => {
});
expect(runWaitpoint).toBeNull();
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down Expand Up @@ -516,7 +516,7 @@ describe("RunEngine Waitpoints", () => {
});
expect(runWaitpoint).toBeNull();
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -664,7 +664,7 @@ describe("RunEngine Waitpoints", () => {
expect(runWaitpoints.length).toBe(0);
}
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down Expand Up @@ -814,7 +814,7 @@ describe("RunEngine Waitpoints", () => {
const isTimeout = isWaitpointOutputTimeout(waitpoint2.output);
expect(isTimeout).toBe(true);
} finally {
engine.quit();
await engine.quit();
}
}
);
Expand Down Expand Up @@ -966,7 +966,7 @@ describe("RunEngine Waitpoints", () => {
expect(waitpoint2.status).toBe("COMPLETED");
expect(waitpoint2.outputIsError).toBe(false);
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down Expand Up @@ -1126,7 +1126,7 @@ describe("RunEngine Waitpoints", () => {
expect(waitpoint2.status).toBe("COMPLETED");
expect(waitpoint2.outputIsError).toBe(false);
} finally {
engine.quit();
await engine.quit();
}
});

Expand Down
7 changes: 4 additions & 3 deletions internal-packages/testcontainers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
"ioredis": "^5.3.2"
},
"devDependencies": {
"@testcontainers/postgresql": "^10.13.1",
"@testcontainers/redis": "^10.13.1",
"@testcontainers/postgresql": "^10.25.0",
"@testcontainers/redis": "^10.25.0",
"@trigger.dev/core": "workspace:*",
"testcontainers": "^10.13.1",
"std-env": "^3.9.0",
"testcontainers": "^10.25.0",
"tinyexec": "^0.3.0",
"vitest": "^1.4.0"
},
Expand Down
Loading