Files
cozystack/packages/system/cozystack-controller/tests/workloadmonitor_crd_test.yaml
T
Aleksei Sviridkin 9f72f0bda9 feat(api): refuse a WorkloadMonitor with an empty selector
An empty selector matches every Pod, PVC, Service and DataVolume in the
namespace, so one such monitor goes non-operational on any import there.
No chart renders one, but the schema marked the field required without
requiring any label, and the API accepted it.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-10-02 14:02:37 +03:00

16 lines
492 B
YAML

suite: WorkloadMonitor CRD
templates:
- templates/crds/crds.yaml
# An empty selector matches every object of each watched kind in the
# namespace, DataVolumes included, so the API refuses one.
tests:
- it: requires at least one selector label
documentSelector:
path: metadata.name
value: workloadmonitors.cozystack.io
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.selector.minProperties
value: 1