|
289 | 289 | # generic DNS-1035 errors and from network/auth failures). |
290 | 290 | echo "$output" | grep -q "tenant names must" |
291 | 291 | # And assert kubectl did NOT report creation — if validation regressed |
292 | | - # into a "warn" variant, the server could still accept the object. |
293 | | - ! echo "$output" | grep -qi "created" |
| 292 | + # into a "warn" variant, the server could still accept the object. A bare |
| 293 | + # `! echo | grep` is vacuous under cozytest's `set -e` (suppressed for a `!` |
| 294 | + # pipeline), so the regression would slip through; assert via `if ...; false`. |
| 295 | + if echo "$output" | grep -qi "created"; then echo "FAIL: kubectl reported the tenant as created — validation must reject it, not warn"; false; fi |
294 | 296 |
|
295 | 297 | # Post-condition cleanup: even though we expect validation to reject the |
296 | 298 | # create, removing foo-bar unconditionally keeps the cluster clean for |
|
395 | 397 | version=$(kubectl get configmap cozystack-version -n cozy-system \ |
396 | 398 | -o jsonpath='{.data.version}') |
397 | 399 | kubectl delete configmap cozystack-version -n cozy-system |
398 | | - ! kubectl get configmap cozystack-version -n cozy-system 2>/dev/null |
| 400 | + # A bare `! kubectl get` is vacuous under cozytest's `set -e` (errexit is |
| 401 | + # suppressed for a `!` pipeline), so a delete that silently failed would not |
| 402 | + # fail the test; assert the absence via `if kubectl get; then ...; false`. |
| 403 | + if kubectl get configmap cozystack-version -n cozy-system 2>/dev/null; then echo "FAIL: cozystack-version configmap must be gone after delete with the no-delete label removed"; false; fi |
399 | 404 | # Reconstruct: declarative apply matches the chart template at |
400 | 405 | # packages/core/platform/templates/cozystack-version.yaml — same label set |
401 | 406 | # AND the helm.sh/resource-policy: keep annotation that pins the ConfigMap |
|
0 commit comments