Files
cozystack/cmd/check-consumption
Aleksei Sviridkin 01496d8130 test(reservation): check shipped declarations on the rendered charts
A consumption declaration on an ApplicationDefinition has to compile
against its kind's schema and evaluate on the kind's defaults, or the
first order of that kind fails. What the cluster gets is what each -rd
chart renders for the variant installed, so that is what to check: the
file layout of cozyrds/ is the chart's own business, and a chart may
keep one definition per variant under a single name.

hack/check-rd-consumption.sh renders every -rd chart with its
values.yaml and once more with each values-<variant>.yaml beside it,
the way a PackageSource variant lists them in valuesFiles, together
with the kubevirt-instancetypes chart. cmd/check-consumption reads that
stream and knows nothing about charts. It fails when a declaration does
not compile or does not evaluate, and when a rendered instance type
does not classify.

cozy-lib's preset table is a template helper with nothing rendered for
it, so an evaluation that reaches preset() stops there and is reported
as compiled; only that lookup is tolerated, an unknown instance type
still fails. The check runs under make unit-tests.

Tested: the command's tests cover a declaration that does not compile,
an instance type missing from the stream, one the classifier rejects
and the preset stop; widening the tolerance to any not-found error
fails them. The script's own test runs it on a stub chart and fails
when only a variant is broken or the chart does not render. A broken
shipped declaration fails the script.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-24 11:49:41 +03:00
..