mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
Phase 6 of the relay split: the relay's deploy/operate surface moves under cloud/ with 24 cloud-* workflows gated on ORCA_CLOUD_OPERATIONS_ENABLED, the Cloud SQL rollout lease action, the relay Terraform root (dual-accept identities for both repositories), scripts, docs, CODEOWNERS, and a terraform validate job in Cloud Verify.
23 lines
859 B
TypeScript
23 lines
859 B
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { absorbPostgresIdleClientErrors } from './database.js'
|
|
|
|
describe('PostgreSQL idle-client failure handling', () => {
|
|
it('absorbs the pool error without logging connection details', () => {
|
|
let listener: ((error: Error) => void) | undefined
|
|
const pool = {
|
|
on: vi.fn((_event: string, value: (error: Error) => void) => {
|
|
listener = value
|
|
return pool
|
|
})
|
|
}
|
|
const warning = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
|
|
absorbPostgresIdleClientErrors(pool as never)
|
|
expect(() => listener?.(new Error('postgres://user:secret@database'))).not.toThrow()
|
|
expect(warning).toHaveBeenCalledWith('[orca-relay] idle PostgreSQL client failed')
|
|
expect(JSON.stringify(warning.mock.calls)).not.toContain('secret')
|
|
|
|
warning.mockRestore()
|
|
})
|
|
})
|