From 5d0b880663c83f9d87b66fbada0a6543d73c6d61 Mon Sep 17 00:00:00 2001 From: muhammad adil ghaffar Date: Mon, 18 Mar 2024 05:44:30 +0200 Subject: [PATCH] Add wait for MachineList to be available Signed-off-by: muhammad adil ghaffar --- test/e2e/clusterctl_upgrade.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/e2e/clusterctl_upgrade.go b/test/e2e/clusterctl_upgrade.go index af5c4828a44c..13794652e69c 100644 --- a/test/e2e/clusterctl_upgrade.go +++ b/test/e2e/clusterctl_upgrade.go @@ -548,6 +548,24 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg input.PostUpgrade(managementClusterProxy, workloadClusterNamespace, managementClusterName) } + // After the upgrade check that MachineList is available. + Byf("[%d] Waiting for MachineList to be available", i) + Eventually(func() error { + postUpgradeMachineList := &unstructured.UnstructuredList{} + postUpgradeMachineList.SetGroupVersionKind(schema.GroupVersionKind{ + Group: clusterv1.GroupVersion.Group, + Version: coreCAPIStorageVersion, + Kind: "MachineList", + }) + err = managementClusterProxy.GetClient().List( + ctx, + postUpgradeMachineList, + client.InNamespace(workloadCluster.GetNamespace()), + client.MatchingLabels{clusterv1.ClusterNameLabel: workloadCluster.GetName()}, + ) + return err + }, "3m", "30s").ShouldNot(HaveOccurred(), "MachineList should be available after the upgrade") + // After the upgrade check that there were no unexpected rollouts. Byf("[%d] Verify there are no unexpected rollouts", i) Consistently(func() bool {