Skip to content

Commit 4852b67

Browse files
authored
Merge pull request #12379 from Okabe-Junya/fix-12340
🌱 Fix e2e test capi-e2e-release-1.8
2 parents fa2b776 + 04a2397 commit 4852b67

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/e2e/self_hosted.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
241241
return selfHostedClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
242242
}, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability")
243243

244+
By("Ensure all machines have NodeRef before doing move")
245+
// Ensure all machines have NodeRef before attempting to move.
246+
// This prevents clusterctl move failures when machines are still provisioning.
247+
framework.WaitForClusterMachineNodeRefs(ctx, framework.WaitForClusterMachineNodeRefsInput{
248+
GetLister: input.BootstrapClusterProxy.GetClient(),
249+
Cluster: cluster,
250+
}, input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade")...)
251+
244252
// Get the machines of the workloadCluster before it is moved to become self-hosted to make sure that the move did not trigger
245253
// any unexpected rollouts.
246254
preMoveMachineList := &unstructured.UnstructuredList{}
@@ -443,6 +451,14 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
443451
return selfHostedClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
444452
}, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability")
445453

454+
By("Ensure all machines have NodeRef before doing move back")
455+
// Ensure all machines have NodeRef before attempting to move back to bootstrap.
456+
// This prevents clusterctl move failures when machines are still provisioning.
457+
framework.WaitForClusterMachineNodeRefs(ctx, framework.WaitForClusterMachineNodeRefsInput{
458+
GetLister: selfHostedClusterProxy.GetClient(),
459+
Cluster: selfHostedCluster,
460+
}, input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade")...)
461+
446462
By("Moving the cluster back to bootstrap")
447463
clusterctl.Move(ctx, clusterctl.MoveInput{
448464
LogFolder: filepath.Join(input.ArtifactFolder, "clusters", clusterResources.Cluster.Name),

0 commit comments

Comments
 (0)