Skip to content

Commit 55d626c

Browse files
androndoclaude
andcommitted
test(keycloak): cover keycloak-db backup image-variant gate
The image-variant switch in templates/db.yaml pins the barman-capable CNPG `system` image exactly when native barmanObjectStore backups render; a regression there silently drops backups to a barman-less `standard` image (#3300). The package is otherwise covered by helm unittest, but db.yaml and this new branching logic had none. Add tests/db_backup_image_test.yaml locking input -> rendered spec.imageName: backups off -> standard, enabled with a destination -> system, and enabled with an empty destinationPath -> standard (the two-part gate). Each case also asserts the barmanObjectStore block co-renders with the system image, so the variant switch and the object-store gate cannot drift apart. Assisted-By: Claude <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Andrey Kolkov <[email protected]>
1 parent 0b10d4b commit 55d626c

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
suite: keycloak-db image variant tracks backup enablement
2+
3+
# Native barmanObjectStore backups need the barman-cloud-* binaries, which
4+
# ship only in the CNPG `system` image variant (see templates/db.yaml). The
5+
# image-variant switch MUST be pinned to `system` exactly when the
6+
# barmanObjectStore block renders, otherwise a base backup fails with
7+
# `barman-cloud-backup: executable file not found` (#3300). This suite locks
8+
# that gate: input (backup.enabled + backup.destinationPath) -> rendered
9+
# spec.imageName, and asserts the object-store block co-renders with `system`.
10+
release:
11+
name: keycloak
12+
namespace: cozy-keycloak
13+
templates:
14+
- templates/db.yaml
15+
tests:
16+
- it: defaults (backups off) render the standard image and no object store
17+
set:
18+
_cluster: {}
19+
asserts:
20+
- equal:
21+
path: spec.imageName
22+
value: ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie
23+
- notExists:
24+
path: spec.backup.barmanObjectStore
25+
26+
- it: backups enabled with a destination pin the barman-capable system image
27+
set:
28+
_cluster: {}
29+
backup:
30+
enabled: true
31+
destinationPath: s3://bucket/keycloak-db/
32+
asserts:
33+
- equal:
34+
path: spec.imageName
35+
value: ghcr.io/cloudnative-pg/postgresql:17.7-system-trixie
36+
# the variant switch and the object-store gate must agree — system image
37+
# is present exactly when the barmanObjectStore renders.
38+
- equal:
39+
path: spec.backup.barmanObjectStore.destinationPath
40+
value: s3://bucket/keycloak-db/
41+
42+
- it: enabled with an empty destinationPath stays standard (two-part gate)
43+
set:
44+
_cluster: {}
45+
backup:
46+
enabled: true
47+
destinationPath: ""
48+
asserts:
49+
- equal:
50+
path: spec.imageName
51+
value: ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie
52+
- notExists:
53+
path: spec.backup.barmanObjectStore

0 commit comments

Comments
 (0)