Skip to content

Commit 9bd545c

Browse files
authored
Merge pull request #7579 from sbueringer/pr-fix-cc-changes-flake
🐛 test/e2e: fix ClusterClass changes flake
2 parents b168862 + 979032a commit 9bd545c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/e2e/clusterclass_changes.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,12 @@ func rebaseClusterClassAndWait(ctx context.Context, input rebaseClusterClassAndW
426426
patchHelper, err := patch.NewHelper(input.Cluster, mgmtClient)
427427
Expect(err).ToNot(HaveOccurred())
428428
input.Cluster.Spec.Topology.Class = newClusterClassName
429-
Expect(patchHelper.Patch(ctx, input.Cluster)).To(Succeed())
429+
// We have to retry the patch. The ClusterClass was just created so the client cache in the
430+
// controller/webhook might not be aware of it yet. If the webhook is not aware of the ClusterClass
431+
// we get a "Cluster ... can't be validated. ClusterClass ... can not be retrieved" error.
432+
Eventually(func() error {
433+
return patchHelper.Patch(ctx, input.Cluster)
434+
}, "1m", "5s").Should(Succeed(), "Failed to patch Cluster")
430435

431436
log.Logf("Waiting for MachineDeployment rollout to complete.")
432437
for _, mdTopology := range input.Cluster.Spec.Topology.Workers.MachineDeployments {

0 commit comments

Comments
 (0)