@@ -36,6 +36,19 @@ expect_render_failure() {
3636 rm -rf " $tmp "
3737}
3838
39+ @test " render matrix refuses empty discovery and ignores nested fixtures" {
40+ tmp=$( mktemp -d)
41+ mkdir -p " $tmp /hack/testdata/render-fixtures/validator"
42+ cp hack/check-render-matrix.sh " $tmp /hack/"
43+ cp hack/testdata/render-fixtures/fresh.yaml " $tmp /hack/testdata/render-fixtures/validator/nested.yaml"
44+ output=$( cd " $tmp " && expect_render_failure)
45+ printf ' %s\n' " $output " | grep -F ' found no charts under packages/apps'
46+ make_render_chart " $tmp /packages/apps/example"
47+ output=$( cd " $tmp " && expect_render_failure)
48+ printf ' %s\n' " $output " | grep -F ' no fixtures under hack/testdata/render-fixtures'
49+ rm -rf " $tmp "
50+ }
51+
3952@test " render matrix reports a broken chart and still checks the next chart" {
4053 tmp=$( mktemp -d)
4154 make_render_chart " $tmp /broken"
@@ -83,6 +96,19 @@ expect_render_failure() {
8396 rm -rf " $tmp "
8497}
8598
99+ @test " render matrix counts documented lookup failures as skipped" {
100+ tmp=$( mktemp -d)
101+ make_render_chart " $tmp /vm-instance"
102+ make_render_chart " $tmp /kubernetes-nodes"
103+ printf ' %s\n' ' {{ fail "Specified instanceType does not exist in the cluster: u1.medium" }}' > " $tmp /vm-instance/templates/object.yaml"
104+ printf ' %s\n' ' {{ fail `specified instanceType "u1.medium" not found in cluster` }}' > " $tmp /kubernetes-nodes/templates/object.yaml"
105+ output=$( dash hack/check-render-matrix.sh " $tmp /vm-instance" " $tmp /kubernetes-nodes" )
106+ printf ' %s\n' " $output " | grep -F ' SKIP vm-instance ('
107+ printf ' %s\n' " $output " | grep -F ' SKIP kubernetes-nodes ('
108+ printf ' %s\n' " $output " | grep -Fx ' check-render-matrix: 0 rendered, 2 skipped'
109+ rm -rf " $tmp "
110+ }
111+
86112@test " fixtures match the injected value types" {
87113 for fixture in hack/testdata/render-fixtures/* .yaml; do
88114 helm template fixture-check hack/testdata/render-fixtures/validator \
@@ -113,6 +139,36 @@ expect_render_failure() {
113139 rm -rf " $tmp "
114140}
115141
142+ @test " fixture validation rejects malformed maps and missing scheduling keys" {
143+ tmp=$( mktemp -d)
144+ for variant in malformed-yaml empty-namespace branding-scalar namespace-map scheduling-scalar missing-scheduling missing-constraint missing-windows; do
145+ cluster_extra=' '
146+ scheduling=' scheduling:'
147+ namespace=' host: "example.org"'
148+ constraint=' globalAppTopologySpreadConstraints: ""'
149+ windows=' dedicatedNodesForWindowsVMs: "false"'
150+ case " $variant " in
151+ malformed-yaml) constraint=' [' ; windows=' ' ; expected=' error converting YAML to JSON' ;;
152+ empty-namespace) namespace=' ' ; expected=' _namespace must be a non-empty map' ;;
153+ branding-scalar) cluster_extra=' branding: true' ; expected=' _cluster.branding must be a map' ;;
154+ namespace-map) namespace=' branding: {}' ; expected=' _namespace.branding must be a string' ;;
155+ scheduling-scalar) constraint=' true' ; windows=' ' ; expected=' _cluster.scheduling must be a map' ;;
156+ missing-scheduling) cluster_extra=' oidc-enabled: "false"' ; scheduling=' ' ; constraint=' ' ; windows=' ' ; expected=' _cluster.scheduling must be a map' ;;
157+ missing-constraint) constraint=' ' ; expected=' _cluster.scheduling.globalAppTopologySpreadConstraints is missing' ;;
158+ missing-windows) windows=' ' ; expected=' _cluster.scheduling.dedicatedNodesForWindowsVMs is missing' ;;
159+ esac
160+ printf ' _cluster:\n %s\n %s\n %s\n %s\n_namespace: {%s}\n' \
161+ " $cluster_extra " " $scheduling " " $constraint " " $windows " " $namespace " > " $tmp /value.yaml"
162+ if output=$( helm template fixture-check hack/testdata/render-fixtures/validator \
163+ --set-file " fixture=$tmp /value.yaml" 2>&1 ) ; then
164+ echo " accepted invalid fixture: $variant " >&2
165+ exit 1
166+ fi
167+ printf ' %s\n' " $output " | grep -F " $expected "
168+ done
169+ rm -rf " $tmp "
170+ }
171+
116172@test " configured scheduling reaches the postgres manifest" {
117173 tmp=$( mktemp -d)
118174 for state in fresh configured wildcard; do
0 commit comments