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 8 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
77 changes: 77 additions & 0 deletions .github/workflows/testcontainers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: "🐳 Testcontainers"

on:
workflow_call:
workflow_dispatch:
push:

jobs:
unitTests:
name: "🧪 Unit Tests (run ${{ matrix.run }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
run: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
- 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
sudo systemctl restart docker

- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.5

- name: ⎔ Setup node
uses: buildjet/setup-node@v4
with:
node-version: 20.11.1
cache: "pnpm"

# ..to avoid rate limits when pulling images
- name: 🐳 Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: 📥 Download deps
run: pnpm install --frozen-lockfile

- name: 📀 Generate Prisma Client
run: pnpm run generate

- name: 🧪 Run Webapp Unit Tests
run: pnpm run test:webapp
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres
SESSION_SECRET: "secret"
MAGIC_LINK_SECRET: "secret"
ENCRYPTION_KEY: "secret"

- name: 🧪 Run Package Unit Tests
run: pnpm run test:packages

- name: 🧪 Run Internal Unit Tests
run: pnpm run test:internal
18 changes: 18 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ jobs:
name: "🧪 Unit Tests"
runs-on: ubuntu-latest
steps:
- name: 🔧 Configure docker
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
sudo systemctl restart docker

- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
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();
}
});
});
Loading
Loading