mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-09 14:02:56 +09:00
run_kubernetes_test applies the tenant Kubernetes CR imperatively (kubectl), so Chainsaw's auto-cleanup — which only tracks resources it apply/create-d — never reclaims it. On success the script's tail deleted it, but on failure nothing did: cozy_cleanup() used to be invoked by hack/cozytest.sh's trap, and the Chainsaw harness has no equivalent caller, so a failed kubernetes-latest/previous run leaked the tenant cluster (tens of GiB of worker PVCs) into the shared tenant-test namespace and starved later suites. Add a `finally` block to both kubernetes suites that runs cozy_cleanup. `finally` always executes, after the `catch` phase, so the ordering matches the BATS harness: pass -> cleanup; fail -> crust-gather (tenant trap + host catch) -> cleanup. cozy_cleanup stays best-effort (|| true) so a slow tenant teardown never flips a passing test red. Assisted-By: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>