Repository navigation
test(tests): make absence-only helm-unittest cases fail when they check nothing - #4664
Conversation
The null-namespace case only checked that the in-cluster name is present, so a chart that emitted a bare "my-redis." SAN, or fell back to the suite-level host, would still pass. It now carries the same absence check as the empty-host case, plus the suite host itself. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
These cases picked a document by position and then asserted only that something is absent from it. When a template gains or reorders a document, the index lands on a different object that lacks the field just as well, and the case stays green while the property it names is no longer checked. Selecting by kind or metadata.name keeps each case on the object it names, and fails with "document not found" when that object stops rendering. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
Each of these templates is wrapped in a top-level condition, and the case asserts only that a field is absent. If a values change turns the condition off, the render is empty and the absence holds trivially, so the case passes without looking at anything. A document selector makes an empty render fail with "document not found". Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: cozystack/cozystack/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe PR updates Helm unit tests to select rendered resources by kind or name instead of document position in several application and system charts. It also adds two absent-SAN assertions to the Redis null-namespace TLS test. Existing assertions remain unchanged where selectors changed. ChangesHelm test assertions
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Other · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The test updates appear to check the intended resources and SAN exclusions, with no material merge risk identified. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
myasnikovdaniil
left a comment
There was a problem hiding this comment.
Looks good, nothing blocking.
Two more cases in the redis tls_test.yaml (around lines 550 and 827) have the shape this PR removes, documentIndex: 3 with only notContains (external=false SAN list and external LB name). With a decoy document in front and the external guard forced on they stay green. Two selectors here would cover them, otherwise they need the follow-up issue from the description, none linked yet.
| content: "my-redis." | ||
| - notContains: | ||
| path: spec.dnsNames | ||
| content: "my-redis.example.com" |
There was a problem hiding this comment.
What this PR does
Twenty-one helm-unittest cases asserted only that something is absent from a document, and could pass without ever looking at the document they name. This PR makes each of them fail when that happens.
documentSelectoronkindormetadata.name, like the earlier harbor conversion.if: kubernetes cilium_gateway_alpn, mongodb restore, linstor-scheduler admission, seaweedfs s3_traffic_distribution and three in vertical-pod-autoscaler. If a values change turns the condition off, the render is empty and the absence check passes on nothing. AdocumentSelectorturns an empty render intodocument not found.my-redis.normy-redis.example.com(the suite-level host that_namespace: nullmust override) is in the SAN list.The
kubernetes clusterentry in the #3634 catalog no longer applies, sincepackages/apps/kubernetes/tests/cluster_test.yamlhas been removed from main. I did not add themy-redis.redis.check that #4621 mentions, because the per-engine SAN it refers to has not landed.Each case was checked by mutation. I broke the template in a way the old case could not see, then ran the chart's
make testwith the new test file and with the one from main. For group 1 I removed the guard and put an extra document in front of the target. For group 2 I turned off the top-level condition. For group 3 I let the empty-host branch emit the bare SAN. Every time the main version stayed green and the new one went red, and the fixed cases were the only extra failures. All templates are back to their committed bytes.Follow-ups, not in this PR:
tls_test.yaml(8 cases), mariadbtls_test.yaml(6), redistls_test.yaml(2 more), kuberneteskamaji_managed_args_test.yaml(2), and one each in kafkadashboard-resourcemap_test.yaml, cert-manager-issuerssolver_test.yamland seaweedfsvolume_resize_hook_test.yaml. They need a separate issue. The four platformbundles_proxy_protocol*cases are testing: negatedcontainsDocumentwithoutany: truepasses on any multi-document render #3864, handled in fix(platform tests): make negated containsDocument assertions load-bearing with any: true #3929.Closes #3634
Closes #4621
Screenshots
Not applicable, test-only change.
Downstream repositories
Release note
Summary by CodeRabbit