Skip to content

Commit c0c35a0

Browse files
committed
Merge remote-tracking branch 'finos/feat/postgres' into feat/postgres-pushes-perf
2 parents 36055fc + 6939f9d commit c0c35a0

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

test/db/postgres/helper.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,12 @@ describe('PostgreSQL - helper', async () => {
312312

313313
describe('getSessionStore', () => {
314314
it('throws when no connection is configured — no MemoryStore fallback', () => {
315-
const savedPgHost = process.env.PGHOST;
316-
delete process.env.PGHOST;
315+
// GitHub-hosted runners preset PGUSER/PGPASSWORD for their bundled
316+
// postgres tooling, and the connection guard honours the PG* family, so
317+
// every variable it reads must be cleared here.
318+
const PG_VARS = ['PGHOST', 'PGHOSTADDR', 'PGUSER', 'PGDATABASE'] as const;
319+
const saved = PG_VARS.map((v) => [v, process.env[v]] as const);
320+
for (const v of PG_VARS) delete process.env[v];
317321
getDatabaseMock.mockReturnValue({
318322
type: 'postgres',
319323
enabled: true,
@@ -324,7 +328,9 @@ describe('PostgreSQL - helper', async () => {
324328
/Postgres connection is required for session storage/,
325329
);
326330

327-
if (savedPgHost !== undefined) process.env.PGHOST = savedPgHost;
331+
for (const [v, val] of saved) {
332+
if (val !== undefined) process.env[v] = val;
333+
}
328334
});
329335

330336
it('passes the shared pool to connect-pg-simple with createTableIfMissing', () => {

0 commit comments

Comments
 (0)