Commit Graph

1 Commits

Author SHA1 Message Date
Armando Ruocco
2a2e09504b test(common): cover WAL restore error classification
Extract the barman-restorer error -> gRPC code switch from
restoreFromBarmanObjectStore into a pure helper,
classifyWALRestoreError, so it can be exercised in isolation
without the surrounding k8s client / configuration scaffolding.

Add ginkgo specs that check:

  - each barman sentinel maps to the expected gRPC status code
    (ErrConnectivity and ErrGeneric both -> Unavailable, since
    barman uses exit 4 for some retryable conditions too),
  - an unclassified error falls through to codes.Internal,
  - classification still works through multiple fmt.Errorf wraps,
  - the switch matches by errors.Is identity rather than message
    substring (so a NotFound whose message happens to mention
    "connectivity" still maps to NotFound).

internal/cnpgi/common had no tests before; this introduces the
suite scaffolding alongside the new specs.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2026-06-03 10:55:07 +02:00