fix(v2/postgres): reject CUSTOM format without projection

Summary

Three follow-up fixes from review of !484 (merged) (multiple PostgreSQL operator secret formats):

  1. fix(v2/postgres)projection() returned (nil, nil) when format: CUSTOM was set with no projection field. The subsequent proj.Host/proj.Port/... accesses in dsn() panicked with a nil-pointer dereference. Now returns ErrSecretProjectionMissing, and the CUSTOM branch uses the nil-safe getter chain for consistency with the UNSPECIFIED→CNPG fallthrough above it. New test case custom format without projection fails exercises the path.
  2. refactor(v2/postgres) — errors flowing back from dsn() had no postgres: prefix, while the sibling error paths in newFromProto (ErrNotConfigured, ErrMissingSecrets) all wrap with it. Wrap once at the call site so the function's error surface is uniform. errors.Is chains are preserved.
  3. test(v2/postgres) — three small typos in client_test.go: requiesrequires, withouwithout, and clientOptions.dns()clientOptions.dsn() in the t.Fatalf format string.
Edited by Alessio Caiazza

Merge request reports

Loading
Loading