diff --git a/graphql/server/__tests__/schema.test.ts b/graphql/server/__tests__/schema.test.ts index d8d09f0ea..2d9be7013 100644 --- a/graphql/server/__tests__/schema.test.ts +++ b/graphql/server/__tests__/schema.test.ts @@ -5,7 +5,7 @@ import express from 'express'; import { postgraphile } from 'postgraphile'; // @ts-ignore import { getGraphileSettings } from 'graphile-settings'; -import { getPgPool } from 'pg-cache'; +import { close as closePgPools, getPgPool } from 'pg-cache'; import { buildSchemaSDL, fetchEndpointSchemaSDL } from '../src/schema'; import { seed, getConnections } from 'graphile-test'; @@ -13,7 +13,7 @@ import { seed, getConnections } from 'graphile-test'; jest.setTimeout(30000); const schemas = ['app_public']; -const sql = (f: string) => join(__dirname, '../../@constructive-io/graphql-test/sql', f); +const sql = (f: string) => join(__dirname, '../../test/sql', f); let db: any; let teardown: () => Promise; @@ -38,6 +38,7 @@ afterAll(async () => { server = null; } await teardown(); + await closePgPools(); }); beforeEach(async () => { @@ -90,4 +91,4 @@ it('fetchEndpointSchemaSDL returns the same SDL as buildSchemaSDL for a running // The SDL generated directly from the database should match the one from HTTP introspection expect(sdlViaHTTP).toBe(sdlDirect); -}); \ No newline at end of file +}); diff --git a/jobs/job-utils/src/runtime.ts b/jobs/job-utils/src/runtime.ts index 689d14bbe..5b0966362 100644 --- a/jobs/job-utils/src/runtime.ts +++ b/jobs/job-utils/src/runtime.ts @@ -18,7 +18,6 @@ export const getJobPgConfig = (): PgConfig => { return { ...defaultPgConfig, ...(opts.pg ?? {}), - ...(opts.jobs?.pg ?? {}), ...envOnly }; }; diff --git a/pgpm/types/src/jobs.ts b/pgpm/types/src/jobs.ts index fd4767b92..feeb2ca08 100644 --- a/pgpm/types/src/jobs.ts +++ b/pgpm/types/src/jobs.ts @@ -1,14 +1,3 @@ -import { PgConfig } from 'pg-env'; - -/** - * Job system PostgreSQL configuration - * Extends the base PgConfig with job-specific database settings - */ -export interface JobPgConfig extends PgConfig { - /** Database name for job system (defaults to 'jobs') */ - database: string; -} - /** * Job schema configuration */ @@ -155,7 +144,7 @@ export interface Job { /** * Worker configuration options */ -export interface JobWorkerConfig extends JobPgConfig, JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig { +export interface JobWorkerConfig extends JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig { /** Polling interval in milliseconds */ pollInterval?: number; /** Whether to enable graceful shutdown */ @@ -165,7 +154,7 @@ export interface JobWorkerConfig extends JobPgConfig, JobSchemaConfig, JobHostna /** * Scheduler configuration options */ -export interface JobSchedulerConfig extends JobPgConfig, JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig { +export interface JobSchedulerConfig extends JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig { /** Polling interval in milliseconds for checking scheduled jobs */ pollInterval?: number; /** Whether to enable graceful shutdown */ @@ -176,8 +165,6 @@ export interface JobSchedulerConfig extends JobPgConfig, JobSchemaConfig, JobHos * Complete job system configuration */ export interface JobsConfig { - /** PostgreSQL database configuration */ - pg?: Partial; /** Job schema configuration */ schema?: Partial; /** Worker configuration */ @@ -192,22 +179,10 @@ export interface JobsConfig { * Default configuration values for job system */ export const jobsDefaults: JobsConfig = { - pg: { - host: 'localhost', - port: 5432, - user: 'postgres', - password: 'password', - database: 'jobs' - }, schema: { schema: 'app_jobs' }, worker: { - host: 'localhost', - port: 5432, - user: 'postgres', - password: 'password', - database: 'jobs', schema: 'app_jobs', hostname: 'worker-0', supportAny: true, @@ -216,11 +191,6 @@ export const jobsDefaults: JobsConfig = { gracefulShutdown: true }, scheduler: { - host: 'localhost', - port: 5432, - user: 'postgres', - password: 'password', - database: 'jobs', schema: 'app_jobs', hostname: 'scheduler-0', supportAny: true, diff --git a/pgpm/types/src/pgpm.ts b/pgpm/types/src/pgpm.ts index 1b701e6ae..c48065ab5 100644 --- a/pgpm/types/src/pgpm.ts +++ b/pgpm/types/src/pgpm.ts @@ -261,22 +261,10 @@ export const pgpmDefaults: PgpmOptions = { } }, jobs: { - pg: { - host: 'localhost', - port: 5432, - user: 'postgres', - password: 'password', - database: 'jobs' - }, schema: { schema: 'app_jobs' }, worker: { - host: 'localhost', - port: 5432, - user: 'postgres', - password: 'password', - database: 'jobs', schema: 'app_jobs', hostname: 'worker-0', supportAny: true, @@ -285,11 +273,6 @@ export const pgpmDefaults: PgpmOptions = { gracefulShutdown: true }, scheduler: { - host: 'localhost', - port: 5432, - user: 'postgres', - password: 'password', - database: 'jobs', schema: 'app_jobs', hostname: 'scheduler-0', supportAny: true,