Skip to content

Commit

Permalink
Merge pull request #8761 from killianmuldoon/pr-ignore-cert-annotation
Browse files Browse the repository at this point in the history
🐛 Ignore cert annotation in rollout test
  • Loading branch information
k8s-ci-robot authored May 27, 2023
2 parents bb287a1 + 499902b commit e111168
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/e2e/clusterclass_rollout.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func assertClusterObjects(ctx context.Context, clusterProxy framework.ClusterPro
assertMachineSetsMachines(g, clusterObjects, cluster)

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

func assertInfrastructureCluster(g Gomega, clusterClassObjects clusterClassObjects, clusterObjects clusterObjects, cluster *clusterv1.Cluster, clusterClass *clusterv1.ClusterClass) {
Expand Down Expand Up @@ -443,7 +443,7 @@ func assertControlPlaneMachines(g Gomega, clusterObjects clusterObjects, cluster
g.Expect(
union(
bootstrapConfig.GetAnnotations(),
).without(clusterv1.MachineCertificatesExpiryDateAnnotation),
).ignore(clusterv1.MachineCertificatesExpiryDateAnnotation),
).To(BeEquivalentTo(
controlPlaneMachineTemplateMetadata.Annotations,
))
Expand Down Expand Up @@ -820,6 +820,16 @@ func (m unionMap) without(keys ...string) unionMap {
return m
}

// ignore removes keys from a unionMap only if they exist.
// Note: This allows ignoring specific keys while comparing maps and is a more tolerant version of `without()`.
func (m unionMap) ignore(keys ...string) unionMap {
for _, key := range keys {
// Only remove the item from the map if it exists.
delete(m, key)
}
return m
}

// getManagedLabels gets a map[string]string and returns another map[string]string
// filtering out labels not managed by CAPI.
// Note: This is replicated from machine_controller_noderef.go.
Expand Down

0 comments on commit e111168

Please sign in to comment.