Skip to content

Commit 80a03b1

Browse files
Andrey Kolkovclaude
andcommitted
test(backups): assert the barman-cloud sidecar checksum env on rendered ObjectStores
helm-unittest coverage for the S3 request-checksum fix (was mutation-negative before): assert spec.instanceSidecarConfiguration.env pins AWS_REQUEST_CHECKSUM_CALCULATION=when_required on all rendered barman-cloud ObjectStores — postgres backup + bootstrap-recovery (packages/apps/postgres/tests/backup_storage_test.yaml) and the Keycloak DB (new packages/system/keycloak/tests/db_backup_test.yaml). Verified by mutation: reverting the template change now fails these assertions. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Andrey Kolkov <[email protected]>
1 parent b574e21 commit 80a03b1

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

‎packages/apps/postgres/tests/backup_storage_test.yaml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ tests:
9797
documentSelector:
9898
path: kind
9999
value: ObjectStore
100+
# The barman-cloud sidecar's S3 request checksum is pinned to when_required
101+
# (non-AWS S3 gateways reject the botocore default flexible checksum).
102+
- equal:
103+
path: spec.instanceSidecarConfiguration.env[0].name
104+
value: AWS_REQUEST_CHECKSUM_CALCULATION
105+
template: templates/db.yaml
106+
documentSelector:
107+
path: kind
108+
value: ObjectStore
109+
- equal:
110+
path: spec.instanceSidecarConfiguration.env[0].value
111+
value: when_required
112+
template: templates/db.yaml
113+
documentSelector:
114+
path: kind
115+
value: ObjectStore
100116
- hasDocuments:
101117
count: 1
102118
template: templates/backup-secret.yaml
@@ -204,6 +220,21 @@ tests:
204220
documentSelector:
205221
path: metadata.name
206222
value: pg-test-recovery
223+
# The non-AWS S3 request-checksum pin is applied to the recovery ObjectStore too.
224+
- equal:
225+
path: spec.instanceSidecarConfiguration.env[0].name
226+
value: AWS_REQUEST_CHECKSUM_CALCULATION
227+
template: templates/db.yaml
228+
documentSelector:
229+
path: metadata.name
230+
value: pg-test-recovery
231+
- equal:
232+
path: spec.instanceSidecarConfiguration.env[0].value
233+
value: when_required
234+
template: templates/db.yaml
235+
documentSelector:
236+
path: metadata.name
237+
value: pg-test-recovery
207238

208239
- it: "bootstrap recovery without serverName: plugin serverName defaults to oldName (native parity)"
209240
# Native CNPG defaulted an absent serverName to the externalClusters entry
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
suite: keycloak DB backup ObjectStore (barman-cloud plugin)
2+
templates:
3+
- templates/db.yaml
4+
release:
5+
name: keycloak
6+
namespace: cozy-keycloak
7+
tests:
8+
- it: "backup enabled: renders a barman-cloud ObjectStore that pins the sidecar S3 request checksum to when_required"
9+
set:
10+
_cluster:
11+
root-host: example.org
12+
cluster-domain: cozy.local
13+
backup:
14+
enabled: true
15+
destinationPath: s3://aenix/keycloak-db/
16+
endpointURL: https://s3.frcloud.kz
17+
existingSecretName: keycloak-db-backup-s3-creds
18+
asserts:
19+
# A barman-cloud ObjectStore is rendered for the Keycloak DB.
20+
- equal:
21+
path: metadata.name
22+
value: keycloak-db
23+
documentSelector:
24+
path: kind
25+
value: ObjectStore
26+
# Non-AWS S3 gateways (Ceph RGW, the platform's SeaweedFS system bucket)
27+
# reject botocore's default flexible checksum; the sidecar must request
28+
# one only when required.
29+
- equal:
30+
path: spec.instanceSidecarConfiguration.env[0].name
31+
value: AWS_REQUEST_CHECKSUM_CALCULATION
32+
documentSelector:
33+
path: kind
34+
value: ObjectStore
35+
- equal:
36+
path: spec.instanceSidecarConfiguration.env[0].value
37+
value: when_required
38+
documentSelector:
39+
path: kind
40+
value: ObjectStore

0 commit comments

Comments
 (0)