fix: put the update into a eventually to avoid flaky error. (#557)

Signed-off-by: xuezhaojun <zxue@redhat.com>
This commit is contained in:
xuezhao
2024-07-08 14:35:36 +08:00
committed by GitHub
parent d1d871a566
commit 5617fec2f7

View File

@@ -124,14 +124,15 @@ var _ = ginkgo.Describe("Cluster Auto Approval", func() {
}, eventuallyTimeout, eventuallyInterval).Should(gomega.Succeed())
// we can deny the cluster after it is accepted
cluster, err := util.GetManagedCluster(clusterClient, clusterName)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Eventually(func() error {
cluster, err := util.GetManagedCluster(clusterClient, clusterName)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
updatedCluster := cluster.DeepCopy()
updatedCluster.Spec.HubAcceptsClient = false
_, err = clusterClient.ClusterV1().ManagedClusters().Update(context.TODO(), updatedCluster, v1.UpdateOptions{})
gomega.Expect(err).NotTo(gomega.HaveOccurred())
updatedCluster := cluster.DeepCopy()
updatedCluster.Spec.HubAcceptsClient = false
_, err = clusterClient.ClusterV1().ManagedClusters().Update(context.TODO(), updatedCluster, v1.UpdateOptions{})
return err
}, eventuallyTimeout, eventuallyInterval).Should(gomega.Succeed())
gomega.Consistently(func() error {
cluster, err := util.GetManagedCluster(clusterClient, clusterName)