From 2dbafebcea0749091a1fcf48994cd0797465d473 Mon Sep 17 00:00:00 2001 From: dswbx Date: Fri, 31 Oct 2025 17:38:17 +0100 Subject: [PATCH] pg test: change is running check approach --- app/__test__/data/postgres.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/__test__/data/postgres.test.ts b/app/__test__/data/postgres.test.ts index d04a25a..c3ec21a 100644 --- a/app/__test__/data/postgres.test.ts +++ b/app/__test__/data/postgres.test.ts @@ -25,7 +25,10 @@ async function cleanDatabase(connection: InstanceType async function isPostgresRunning() { try { - await $`docker exec bknd-test-postgres pg_isready -U ${credentials.user}`; + // Try to actually connect to PostgreSQL + const conn = pg(credentials); + await conn.ping(); + await conn.close(); return true; } catch (e) { return false; @@ -44,7 +47,9 @@ describe("postgres", () => { }); afterAll(async () => { if (await isPostgresRunning()) { - await $`docker stop bknd-test-postgres`; + try { + await $`docker stop bknd-test-postgres`; + } catch (e) {} } enableConsoleLog();