Skip to content

Commit 8aadbd5

Browse files
committed
test(backupstrategy-controller): anchor the metrics-absence guard to its container
The two notContains assertions in the metrics.enabled=false case address the controller by index. notContains passes whenever its path resolves to something that lacks the forbidden content, and a different container at that index qualifies, so a sidecar inserted ahead of the controller leaves both assertions green while the flag they forbid comes back on the real container. Assert the container's name at the same index first. That fails when the index stops pointing at the controller, which is the case the negatives structurally cannot see. Verified by rendering a sidecar ahead of the controller: before this change the case stayed green and only unrelated tests in the same file went red, by accident rather than by design; after it, the anchor fails. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent c6eb584 commit 8aadbd5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎packages/system/backupstrategy-controller/tests/deployment_test.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ tests:
2828
set:
2929
backupStrategyController.metrics.enabled: false
3030
asserts:
31+
# Anchor first: the two assertions below address a container by index, and
32+
# notContains passes whenever its path resolves to something without the
33+
# forbidden content — including a different container. A sidecar inserted
34+
# ahead of this one would leave both of them green while the flag they
35+
# exist to forbid came back on the controller. This equal is what fails in
36+
# that case; the negatives cannot.
37+
- equal:
38+
path: spec.template.spec.containers[0].name
39+
value: backupstrategy-controller
3140
- notContains:
3241
path: spec.template.spec.containers[0].args
3342
content: --metrics-bind-address=:8443

0 commit comments

Comments
 (0)