mirror of
https://github.com/cozystack/cozystack.git
synced 2026-10-23 03:27:50 +09:00
The shell translator rewrites test bodies and loses Bats reporting. The unit lane needs complete TAP results and JUnit reports without changing how live-cluster suites run. Sourced production helpers still need a dash pass, and unit test bodies need nounset without exporting shell options into subprocesses. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
26 lines
1.3 KiB
Bash
26 lines
1.3 KiB
Bash
#!/usr/bin/env bats
|
|
# The kamaji package ships its CRDs from charts/kamaji-crds/templates/, which
|
|
# read their schema with .Files.Get from charts/kamaji-crds/hack/. Helm skips
|
|
# .helmignore when it reads a chart out of an archive and honours it when it
|
|
# reads one out of a directory, so a pattern matching that hack/ directory
|
|
# leaves the cluster with full schemas and every local render, lint and package
|
|
# with a CRD whose spec is empty. That split hides schema defects from every
|
|
# check that runs before a cluster sees the chart, which is all of ours.
|
|
#
|
|
# The package path is relative because both runners invoke these from the
|
|
# repository root, as the neighbouring render tests assume too.
|
|
|
|
load test_helper
|
|
|
|
@test "kamaji CRD templates render their schema" {
|
|
rendered=$(helm template kamaji packages/system/kamaji --namespace cozy-kamaji)
|
|
|
|
for crd in tenantcontrolplanes datastores kubeconfiggenerators; do
|
|
versions=$(printf '%s\n' "$rendered" | yq -r "select(.metadata.name == \"$crd.kamaji.clastix.io\") | .spec.versions | length")
|
|
[ "$versions" -gt 0 ]
|
|
done
|
|
|
|
spec_props=$(printf '%s\n' "$rendered" | yq -r 'select(.metadata.name == "tenantcontrolplanes.kamaji.clastix.io") | .spec.versions[0].schema.openAPIV3Schema.properties.spec.properties | length')
|
|
[ "$spec_props" -gt 0 ]
|
|
}
|