Skip to content

Commit e111168

Browse files
authored
Merge pull request #8761 from killianmuldoon/pr-ignore-cert-annotation
🐛 Ignore cert annotation in rollout test
2 parents bb287a1 + 499902b commit e111168

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/e2e/clusterclass_rollout.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func assertClusterObjects(ctx context.Context, clusterProxy framework.ClusterPro
268268
assertMachineSetsMachines(g, clusterObjects, cluster)
269269

270270
By("All cluster objects have the right labels, annotations and selectors")
271-
}, 30*time.Second, 1*time.Second).Should(Succeed())
271+
}, 10*time.Second, 1*time.Second).Should(Succeed())
272272
}
273273

274274
func assertInfrastructureCluster(g Gomega, clusterClassObjects clusterClassObjects, clusterObjects clusterObjects, cluster *clusterv1.Cluster, clusterClass *clusterv1.ClusterClass) {
@@ -443,7 +443,7 @@ func assertControlPlaneMachines(g Gomega, clusterObjects clusterObjects, cluster
443443
g.Expect(
444444
union(
445445
bootstrapConfig.GetAnnotations(),
446-
).without(clusterv1.MachineCertificatesExpiryDateAnnotation),
446+
).ignore(clusterv1.MachineCertificatesExpiryDateAnnotation),
447447
).To(BeEquivalentTo(
448448
controlPlaneMachineTemplateMetadata.Annotations,
449449
))
@@ -820,6 +820,16 @@ func (m unionMap) without(keys ...string) unionMap {
820820
return m
821821
}
822822

823+
// ignore removes keys from a unionMap only if they exist.
824+
// Note: This allows ignoring specific keys while comparing maps and is a more tolerant version of `without()`.
825+
func (m unionMap) ignore(keys ...string) unionMap {
826+
for _, key := range keys {
827+
// Only remove the item from the map if it exists.
828+
delete(m, key)
829+
}
830+
return m
831+
}
832+
823833
// getManagedLabels gets a map[string]string and returns another map[string]string
824834
// filtering out labels not managed by CAPI.
825835
// Note: This is replicated from machine_controller_noderef.go.

0 commit comments

Comments
 (0)