Skip to content

Commit dc7ff5d

Browse files
committed
Fix metadata assert failure in clusterclass rollout test
Add union() to convert a potential nil map to an empty map, otherwise the test will faile due to compare a nil map and an empty one.
1 parent d79694c commit dc7ff5d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/e2e/clusterclass_rollout.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ func assertControlPlane(g Gomega, clusterClassObjects clusterClassObjects, clust
407407
ccControlPlaneTemplateMachineTemplateMetadata.Labels,
408408
),
409409
))
410-
g.Expect(controlPlaneMachineTemplateMetadata.Annotations).To(BeEquivalentTo(
410+
g.Expect(union(controlPlaneMachineTemplateMetadata.Annotations)).To(BeEquivalentTo(
411411
union(
412412
cluster.Spec.Topology.ControlPlane.Metadata.Annotations,
413413
clusterClass.Spec.ControlPlane.Metadata.Annotations,
@@ -466,8 +466,8 @@ func assertControlPlaneMachines(g Gomega, clusterObjects clusterObjects, cluster
466466
union(
467467
machineMetadata.Annotations,
468468
).without(g, controlplanev1.KubeadmClusterConfigurationAnnotation),
469-
).To(BeEquivalentTo(
470-
controlPlaneMachineTemplateMetadata.Annotations,
469+
).To(BeEquivalentTo(union(
470+
controlPlaneMachineTemplateMetadata.Annotations),
471471
))
472472

473473
// ControlPlane Machine InfrastructureMachine.metadata
@@ -516,8 +516,8 @@ func assertControlPlaneMachines(g Gomega, clusterObjects clusterObjects, cluster
516516
union(
517517
bootstrapConfigMetadata.Annotations,
518518
).without(g, clusterv1.MachineCertificatesExpiryDateAnnotation),
519-
).To(BeEquivalentTo(
520-
controlPlaneMachineTemplateMetadata.Annotations,
519+
).To(BeEquivalentTo(union(
520+
controlPlaneMachineTemplateMetadata.Annotations),
521521
))
522522

523523
// ControlPlane Machine Node.metadata
@@ -580,7 +580,7 @@ func assertMachineDeployments(g Gomega, clusterClassObjects clusterClassObjects,
580580
mdClass.Template.Metadata.Labels,
581581
),
582582
))
583-
g.Expect(machineDeployment.Spec.Template.Annotations).To(BeEquivalentTo(
583+
g.Expect(union(machineDeployment.Spec.Template.Annotations)).To(BeEquivalentTo(
584584
union(
585585
mdTopology.Metadata.Annotations,
586586
mdClass.Template.Metadata.Annotations,
@@ -693,7 +693,7 @@ func assertMachinePools(g Gomega, clusterClassObjects clusterClassObjects, clust
693693
mpClass.Template.Metadata.Labels,
694694
),
695695
))
696-
g.Expect(machinePool.Spec.Template.Annotations).To(BeEquivalentTo(
696+
g.Expect(union(machinePool.Spec.Template.Annotations)).To(BeEquivalentTo(
697697
union(
698698
mpTopology.Metadata.Annotations,
699699
mpClass.Template.Metadata.Annotations,

0 commit comments

Comments
 (0)