Skip to content

Commit

Permalink
Fix metadata assert failure in clusterclass rollout test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zhanggbj committed Jul 8, 2024
1 parent d79694c commit dc7ff5d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/e2e/clusterclass_rollout.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func assertControlPlane(g Gomega, clusterClassObjects clusterClassObjects, clust
ccControlPlaneTemplateMachineTemplateMetadata.Labels,
),
))
g.Expect(controlPlaneMachineTemplateMetadata.Annotations).To(BeEquivalentTo(
g.Expect(union(controlPlaneMachineTemplateMetadata.Annotations)).To(BeEquivalentTo(
union(
cluster.Spec.Topology.ControlPlane.Metadata.Annotations,
clusterClass.Spec.ControlPlane.Metadata.Annotations,
Expand Down Expand Up @@ -466,8 +466,8 @@ func assertControlPlaneMachines(g Gomega, clusterObjects clusterObjects, cluster
union(
machineMetadata.Annotations,
).without(g, controlplanev1.KubeadmClusterConfigurationAnnotation),
).To(BeEquivalentTo(
controlPlaneMachineTemplateMetadata.Annotations,
).To(BeEquivalentTo(union(
controlPlaneMachineTemplateMetadata.Annotations),
))

// ControlPlane Machine InfrastructureMachine.metadata
Expand Down Expand Up @@ -516,8 +516,8 @@ func assertControlPlaneMachines(g Gomega, clusterObjects clusterObjects, cluster
union(
bootstrapConfigMetadata.Annotations,
).without(g, clusterv1.MachineCertificatesExpiryDateAnnotation),
).To(BeEquivalentTo(
controlPlaneMachineTemplateMetadata.Annotations,
).To(BeEquivalentTo(union(
controlPlaneMachineTemplateMetadata.Annotations),
))

// ControlPlane Machine Node.metadata
Expand Down Expand Up @@ -580,7 +580,7 @@ func assertMachineDeployments(g Gomega, clusterClassObjects clusterClassObjects,
mdClass.Template.Metadata.Labels,
),
))
g.Expect(machineDeployment.Spec.Template.Annotations).To(BeEquivalentTo(
g.Expect(union(machineDeployment.Spec.Template.Annotations)).To(BeEquivalentTo(
union(
mdTopology.Metadata.Annotations,
mdClass.Template.Metadata.Annotations,
Expand Down Expand Up @@ -693,7 +693,7 @@ func assertMachinePools(g Gomega, clusterClassObjects clusterClassObjects, clust
mpClass.Template.Metadata.Labels,
),
))
g.Expect(machinePool.Spec.Template.Annotations).To(BeEquivalentTo(
g.Expect(union(machinePool.Spec.Template.Annotations)).To(BeEquivalentTo(
union(
mpTopology.Metadata.Annotations,
mpClass.Template.Metadata.Annotations,
Expand Down

0 comments on commit dc7ff5d

Please sign in to comment.