Files
cozystack/packages/system/backupstrategy-controller/tests/deployment_test.yaml
T
Alexey Artamonov 9376ba0078 fix(backups): hand every driver the same forcePathStyle
backupStorage.forcePathStyle reaches drivers that read it differently.
The controller, Velero and the ClickHouse sidecar parse it with
strconv.ParseBool, the etcd and MongoDB strategies write it into a
boolean field that Helm decodes as YAML 1.1, and the Kafka and
RabbitMQ scripts take anything but the string "false" as path style.
So "False" meant path style to Kafka and RabbitMQ only; "yes" meant
path style to etcd, MongoDB, Kafka and RabbitMQ and was refused by
Velero and the ClickHouse sidecar; "T" and "1" could not be applied to
the boolean fields.

The chart now accepts the spellings of strconv.ParseBool and of YAML
1.1 booleans, a superset of the boolean spellings the etcd and MongoDB
strategies accepted, and passes every consumer "true" or "false", so
they agree. Unset stays unset, so each driver keeps its own default.
Any other value fails the render with a message naming it.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
2026-11-06 17:56:59 +03:00

66 lines
2.5 KiB
YAML

suite: controller Deployment — metrics wiring and projector source namespace
# Guards the metrics.enable -> metrics.enabled fix (the misspelled key was
# always nil, so the metrics arg and port were silently never rendered) and
# pins the projector's source namespace to backupStorage.namespace, which is
# what the credential-projection comments describe.
templates:
- templates/deployment.yaml
release:
name: t
namespace: cozy-backup-controller
tests:
- it: "metrics.enabled=true (default): --metrics-bind-address arg and metrics port are rendered"
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --metrics-bind-address=:8443
- contains:
path: spec.template.spec.containers[0].ports
content:
name: metrics
any: true
- it: "metrics.enabled=false: metrics arg and port are absent (regression guard for the metrics.enable typo)"
set:
backupStrategyController.metrics.enabled: false
asserts:
# Anchor first: the two assertions below address a container by index, and
# notContains passes whenever its path resolves to something without the
# forbidden content — including a different container. A sidecar inserted
# ahead of this one would leave both of them green while the flag they
# exist to forbid came back on the controller. This equal is what fails in
# that case; the negatives cannot.
- equal:
path: spec.template.spec.containers[0].name
value: backupstrategy-controller
- notContains:
path: spec.template.spec.containers[0].args
content: --metrics-bind-address=:8443
- notContains:
path: spec.template.spec.containers[0].ports
content:
name: metrics
any: true
- it: "projector reads its source Secret from backupStorage.namespace (tenant-root by default)"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: BACKUP_STORAGE_SECRET_NAMESPACE
value: tenant-root
any: true
# A value no consumer took as a boolean is refused once, at render time; see
# tests/force_path_style_test.yaml for what each consumer receives.
- it: "forcePathStyle that is no boolean spelling fails the render and names the value"
set:
backupStorage.forcePathStyle: "maybe"
asserts:
- failedTemplate:
errorPattern: 'backupStorage\.forcePathStyle must be a boolean or unset, got "maybe"'