4 Commits
Author SHA1 Message Date
shishantbiswas 784b881797 Update app/__test__/data/postgres.test.ts
Run Tests / test (pull_request) Successful in 7m2s
2026-09-25 10:25:08 +00:00
shishantbiswas c358b5b9b7 Update app/__test__/data/postgres.test.ts
Run Tests / test (pull_request) Failing after 5m34s
2026-09-25 10:14:53 +00:00
shishantbiswas 8cb3abd071 Update .github/workflows/test.yml
Run Tests / test (pull_request) Failing after 3m0s
2026-09-25 09:50:08 +00:00
shishantbiswas 6d52be230f Update app/__test__/data/postgres.test.ts 2026-09-25 09:49:31 +00:00
2 changed files with 10 additions and 4 deletions
-2
View File
@@ -16,8 +16,6 @@ jobs:
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_DB: bknd POSTGRES_DB: bknd
ports:
- 5430:5432
options: >- options: >-
--health-cmd pg_isready --health-cmd pg_isready
--health-interval 10s --health-interval 10s
+10 -2
View File
@@ -8,9 +8,12 @@ import { $ } from "bun";
import { connectionTestSuite } from "data/connection/connection-test-suite"; import { connectionTestSuite } from "data/connection/connection-test-suite";
import { bunTestRunner } from "adapter/bun/test"; import { bunTestRunner } from "adapter/bun/test";
const isCI = !!(process.env.GITEA_ACTIONS || process.env.GITHUB_ACTIONS);
const credentials = { const credentials = {
host: "localhost", // Changes to "postgres" inside CI to talk directly to the Gitea service container
port: 5430, host: isCI ? "postgres" : "localhost",
port: 5432,
user: "postgres", user: "postgres",
password: "postgres", password: "postgres",
database: "bknd", database: "bknd",
@@ -39,6 +42,11 @@ async function isPostgresRunning() {
describe("postgres", () => { describe("postgres", () => {
beforeAll(async () => { beforeAll(async () => {
if (process.env.GITEA_ACTIONS || process.env.GITHUB_ACTIONS) {
console.log("Running in CI: Skipping manual docker run");
return;
}
if (!(await isPostgresRunning())) { if (!(await isPostgresRunning())) {
await $`docker run --rm --name bknd-test-postgres -d -e POSTGRES_PASSWORD=${credentials.password} -e POSTGRES_USER=${credentials.user} -e POSTGRES_DB=${credentials.database} -p ${credentials.port}:5432 postgres:17`; await $`docker run --rm --name bknd-test-postgres -d -e POSTGRES_PASSWORD=${credentials.password} -e POSTGRES_USER=${credentials.user} -e POSTGRES_DB=${credentials.database} -p ${credentials.port}:5432 postgres:17`;
await $waitUntil("Postgres is running", isPostgresRunning, 500, 20); await $waitUntil("Postgres is running", isPostgresRunning, 500, 20);