Files
cozystack/internal/crdinstall
Myasnikov Daniil 5d263a1e25 test(crdinstall): assert no-delete label survives Install + merge
Address review feedback from @lllamnyp on internal/crdinstall/install.go:
the deletion-protection label loop was untested — TestInstall_appliesAllCRDs
only checked that Install returned no error, so a refactor dropping the loop
would have shipped green and silently disabled VAP coverage on every Cozystack
CRD.

- Extend TestInstall_appliesAllCRDs to read each applied CRD back from the fake
  client and assert platform.cozystack.io/no-delete=true is present.
- Add TestInstall_preservesExistingLabels: feeds in a CRD whose manifest already
  carries app.kubernetes.io/managed-by=foo, asserts both that label and the
  deletion-protection label end up on the applied object. Locks down the merge
  contract in install.go:92-101 (the GetLabels()==nil branch is still covered
  by the first test).

Verified the new assertions fail when the label-stamping loop is removed.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-05-26 15:12:52 +05:00
..