@@ -13,6 +13,9 @@ import (
1313 "sigs.k8s.io/cluster-api/test/framework"
1414 "sigs.k8s.io/cluster-api/test/framework/clusterctl"
1515 "sigs.k8s.io/controller-runtime/pkg/client"
16+ clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
17+ infrav1 "github.com/metal3-io/cluster-api-provider-metal3/api/v1beta1"
18+ "net/http"
1619)
1720
1821var (
@@ -192,6 +195,27 @@ func createTargetCluster(k8sVersion string) (framework.ClusterProxy, *clusterctl
192195 ControlPlaneMachineCount : & controlPlaneMachineCount ,
193196 WorkerMachineCount : & workerMachineCount ,
194197 },
198+ PreWaitForCluster : func () {
199+ // get bmh
200+ // get m3m
201+ // waiting machine
202+ By ("Waiting for all Machines to be provisioning" )
203+ WaitForNumMachinesInState (ctx , clusterv1 .MachinePhaseProvisioning , WaitForNumInput {
204+ Client : bootstrapClusterProxy .GetClient (),
205+ Options : []client.ListOption {client .InNamespace (namespace )},
206+ Replicas : 1 ,
207+ Intervals : e2eConfig .GetIntervals (specName , "wait-machine-remediation" ),
208+ })
209+
210+ metal3Machines := infrav1.Metal3MachineList {}
211+ bootstrapClusterProxy .GetClient ().List (ctx , & metal3Machines , []client.ListOption {client .InNamespace (namespace )}... )
212+ for _ , m3machine := range metal3Machines .Items {
213+ providerID := "metal3://metal3/" + Metal3MachineToBmhName (m3machine )+ "/" + m3machine .GetName ()
214+ machine , _ := Metal3MachineToMachineName (m3machine )
215+ resp , err := http .Get ("http://localhost:3333/updateNode?resource=metal3/test1&nodeName=" + machine + "&providerID=" + providerID )
216+ Logf ("resp : %v err: %v" , resp , err )
217+ }
218+ },
195219 WaitForClusterIntervals : e2eConfig .GetIntervals (specName , "wait-cluster" ),
196220 WaitForControlPlaneIntervals : e2eConfig .GetIntervals (specName , "wait-control-plane" ),
197221 WaitForMachineDeployments : e2eConfig .GetIntervals (specName , "wait-worker-nodes" ),
0 commit comments