Repository navigation
test: preserve HCO jsonpatch annotations - #513
openshift-merge-bot[bot] merged 1 commit into
Conversation
|
Thank you for adding this test — it's great to see the user-managed HCO jsonpatch annotations getting regression coverage. The core promise of the PR is well covered: a regression that replaces the SSA apply with a full Update, or overwrites the annotation values, would fail this test. If you're open to a small suggestion, I think two cheap assertions could make it a bit harder to defeat accidentally: 1. Assert that the first reconciliation actually applied The return value of By("reconciling the HCO golden configuration twice")
applied, err := patcher.ReconcileAsset(ctx, hcoAsset, renderCtx)
Expect(err).NotTo(HaveOccurred())
Expect(applied).To(BeTrue(),
"first reconciliation must adopt the pre-existing HCO via SSA; "+
"a silent skip would make the annotations survive trivially")
_, err = patcher.ReconcileAsset(ctx, hcoAsset, renderCtx)
Expect(err).NotTo(HaveOccurred())This pattern is already used in 2. Verify the golden markers landed on the reconciled object Asserting that Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(hco), reconciled)).To(Succeed())
Expect(reconciled.GetAnnotations()).To(HaveKeyWithValue("platform.kubevirt.io/version", "1.0.0"),
"golden markers must be present, proving SSA ran on the user's object")
for key, value := range hcoJSONPatches {
Expect(reconciled.GetAnnotations()).To(HaveKeyWithValue(key, value))
}Both are entirely optional hardening — the test is correct and valuable as is. Feel free to take them, adapt them, or ignore them. Thanks again for putting this together! |
HCO jsonpatch annotations (*.kubevirt.io/jsonpatch) are critical user controls. Protect them from deletion or overwrite regressions. Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
94df71f to
4a51ba5
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rlobillo The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
92684a2
into
openshift-virtualization:main
HCO jsonpatch annotations (
*.kubevirt.io/jsonpatch) are critical user controls.Protect them from deletion or overwrite regressions.