Remove TEST_DATABASE_URL

This commit is contained in:
Alex Gleason 2024-10-18 13:25:39 -05:00
parent f6046c015b
commit c390481939
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 3 additions and 8 deletions

View file

@ -28,7 +28,7 @@ test:
- postgres:16 - postgres:16
variables: variables:
DITTO_NSEC: nsec1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs4rm7hz DITTO_NSEC: nsec1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs4rm7hz
TEST_DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
POSTGRES_HOST_AUTH_METHOD: trust POSTGRES_HOST_AUTH_METHOD: trust
artifacts: artifacts:
when: always when: always

View file

@ -70,10 +70,6 @@ class Conf {
static get databaseUrl(): string { static get databaseUrl(): string {
return Deno.env.get('DATABASE_URL') ?? 'file://data/pgdata'; return Deno.env.get('DATABASE_URL') ?? 'file://data/pgdata';
} }
/** Database to use in tests. */
static get testDatabaseUrl(): string {
return Deno.env.get('TEST_DATABASE_URL') ?? 'memory://';
}
/** PGlite debug level. 0 disables logging. */ /** PGlite debug level. 0 disables logging. */
static get pgliteDebug(): 0 | 1 | 2 | 3 | 4 | 5 { static get pgliteDebug(): 0 | 1 | 2 | 3 | 4 | 5 {
return Number(Deno.env.get('PGLITE_DEBUG') || 0) as 0 | 1 | 2 | 3 | 4 | 5; return Number(Deno.env.get('PGLITE_DEBUG') || 0) as 0 | 1 | 2 | 3 | 4 | 5;

View file

@ -34,10 +34,9 @@ export function genEvent(t: Partial<NostrEvent> = {}, sk: Uint8Array = generateS
return purifyEvent(event); return purifyEvent(event);
} }
/** Create a database for testing. It uses `TEST_DATABASE_URL`, or creates an in-memory database by default. */ /** Create a database for testing. It uses `DATABASE_URL`, or creates an in-memory database by default. */
export async function createTestDB(opts?: { pure?: boolean }) { export async function createTestDB(opts?: { pure?: boolean }) {
const { testDatabaseUrl } = Conf; const { kysely } = DittoDB.create(Conf.databaseUrl, { poolSize: 1 });
const { kysely } = DittoDB.create(testDatabaseUrl, { poolSize: 1 });
await DittoDB.migrate(kysely); await DittoDB.migrate(kysely);