Force tests to run on kyoo_test database

This commit is contained in:
Zoe Roux 2025-11-23 22:41:52 +01:00
parent 7ebc0fe504
commit 20ab1dae6c
No known key found for this signature in database
3 changed files with 6 additions and 2 deletions

View File

@ -15,10 +15,11 @@ jobs:
postgres: postgres:
image: postgres:15 image: postgres:15
ports: ports:
- "5432:5432" - "5432:5432"
env: env:
POSTGRES_USER: kyoo POSTGRES_USER: kyoo
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
POSTGRES_DB: kyoo_test
options: >- options: >-
--health-cmd pg_isready --health-cmd pg_isready
--health-interval 10s --health-interval 10s

View File

@ -112,6 +112,7 @@ const postgresConfig = await parseSslConfig();
// use this when using drizzle-kit since it can't parse await statements // use this when using drizzle-kit since it can't parse await statements
// const postgresConfig = config; // const postgresConfig = config;
console.log("Connecting to postgres with config", postgresConfig);
export const db = drizzle({ export const db = drizzle({
schema, schema,
connection: postgresConfig, connection: postgresConfig,

View File

@ -1,9 +1,11 @@
import { beforeAll } from "bun:test"; import { beforeAll } from "bun:test";
import { migrate } from "~/db";
process.env.PGDATABASE = "kyoo_test";
process.env.JWT_SECRET = "this is a secret"; process.env.JWT_SECRET = "this is a secret";
process.env.JWT_ISSUER = "https://kyoo.zoriya.dev"; process.env.JWT_ISSUER = "https://kyoo.zoriya.dev";
beforeAll(async () => { beforeAll(async () => {
// lazy load this so env set before actually applies
const { migrate } = await import("~/db");
await migrate(); await migrate();
}); });