mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-07-07 02:02:21 +02:00
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>
|
||
|---|---|---|
| .. | ||
| check.go | ||
| common.go | ||
| doc.go | ||
| errors_test.go | ||
| errors.go | ||
| health.go | ||
| scheme.go | ||
| suite_test.go | ||
| wal_import.go | ||
| wal.go | ||