Loading
fix(v2/postgres): reject CUSTOM format without projection
Summary
Three follow-up fixes from review of !484 (merged) (multiple PostgreSQL operator secret formats):
fix(v2/postgres)—projection()returned(nil, nil)whenformat: CUSTOMwas set with noprojectionfield. The subsequentproj.Host/proj.Port/... accesses indsn()panicked with a nil-pointer dereference. Now returnsErrSecretProjectionMissing, and the CUSTOM branch uses the nil-safe getter chain for consistency with the UNSPECIFIED→CNPG fallthrough above it. New test casecustom format without projection failsexercises the path.refactor(v2/postgres)— errors flowing back fromdsn()had nopostgres:prefix, while the sibling error paths innewFromProto(ErrNotConfigured,ErrMissingSecrets) all wrap with it. Wrap once at the call site so the function's error surface is uniform.errors.Ischains are preserved.test(v2/postgres)— three small typos inclient_test.go:requies→requires,withou→without, andclientOptions.dns()→clientOptions.dsn()in thet.Fatalfformat string.
Edited by Alessio Caiazza