@@ -141,109 +141,113 @@ func QuickStartSpec(ctx context.Context, inputGetter func() QuickStartSpecInput)
141141 It ("Should create a workload cluster" , func () {
142142 By ("Creating a workload cluster" )
143143
144- infrastructureProvider := clusterctl .DefaultInfrastructureProvider
145- if input .InfrastructureProvider != nil {
146- infrastructureProvider = * input .InfrastructureProvider
147- }
144+ for i := 0 ; i < 50 ; i ++ {
148145
149- flavor := clusterctl .DefaultFlavor
150- if input .Flavor != nil {
151- flavor = * input .Flavor
152- }
146+ infrastructureProvider := clusterctl .DefaultInfrastructureProvider
147+ if input .InfrastructureProvider != nil {
148+ infrastructureProvider = * input .InfrastructureProvider
149+ }
153150
154- controlPlaneMachineCount := ptr. To [ int64 ]( 1 )
155- if input .ControlPlaneMachineCount != nil {
156- controlPlaneMachineCount = input .ControlPlaneMachineCount
157- }
151+ flavor := clusterctl . DefaultFlavor
152+ if input .Flavor != nil {
153+ flavor = * input .Flavor
154+ }
158155
159- workerMachineCount := ptr.To [int64 ](1 )
160- if input .WorkerMachineCount != nil {
161- workerMachineCount = input .WorkerMachineCount
162- }
156+ controlPlaneMachineCount := ptr.To [int64 ](1 )
157+ if input .ControlPlaneMachineCount != nil {
158+ controlPlaneMachineCount = input .ControlPlaneMachineCount
159+ }
163160
164- clusterName := fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
165- if input .ClusterName != nil {
166- clusterName = * input .ClusterName
167- }
161+ workerMachineCount := ptr.To [int64 ](1 )
162+ if input .WorkerMachineCount != nil {
163+ workerMachineCount = input .WorkerMachineCount
164+ }
165+
166+ clusterName := fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
167+ if input .ClusterName != nil {
168+ clusterName = * input .ClusterName
169+ }
170+
171+ if input .ExtensionServiceNamespace != "" && input .ExtensionServiceName != "" {
172+ // NOTE: test extension is already deployed in the management cluster. If for any reason in future we want
173+ // to make this test more self-contained this test should be modified in order to create an additional
174+ // management cluster; also the E2E test configuration should be modified introducing something like
175+ // optional:true allowing to define which providers should not be installed by default in
176+ // a management cluster.
177+ By ("Deploy Test Extension ExtensionConfig" )
178+
179+ // In this test we are defaulting all handlers to non-blocking because we don't expect the handlers to block the
180+ // cluster lifecycle by default. Setting defaultAllHandlersToBlocking to false enforces that the test-extension
181+ // automatically creates the ConfigMap with non-blocking preloaded responses.
182+ defaultAllHandlersToBlocking := false
183+ // select on the current namespace
184+ // This is necessary so in CI this test doesn't influence other tests by enabling lifecycle hooks
185+ // in other test namespaces.
186+ namespaces := []string {namespace .Name }
187+ if input .DeployClusterClassInSeparateNamespace {
188+ // Add the ClusterClass namespace, if the ClusterClass is deployed in a separate namespace.
189+ namespaces = append (namespaces , clusterClassNamespace .Name )
190+ }
191+ extensionConfig := extensionConfig (input .ExtensionConfigName , input .ExtensionServiceNamespace , input .ExtensionServiceName , defaultAllHandlersToBlocking , namespaces ... )
192+ Expect (input .BootstrapClusterProxy .GetClient ().Create (ctx ,
193+ extensionConfig )).
194+ To (Succeed (), "Failed to create the ExtensionConfig" )
195+ }
196+
197+ variables := map [string ]string {
198+ // This is used to template the name of the ExtensionConfig into the ClusterClass.
199+ "EXTENSION_CONFIG_NAME" : input .ExtensionConfigName ,
200+ }
201+ maps .Copy (variables , input .ClusterctlVariables )
168202
169- if input .ExtensionServiceNamespace != "" && input .ExtensionServiceName != "" {
170- // NOTE: test extension is already deployed in the management cluster. If for any reason in future we want
171- // to make this test more self-contained this test should be modified in order to create an additional
172- // management cluster; also the E2E test configuration should be modified introducing something like
173- // optional:true allowing to define which providers should not be installed by default in
174- // a management cluster.
175- By ("Deploy Test Extension ExtensionConfig" )
176-
177- // In this test we are defaulting all handlers to non-blocking because we don't expect the handlers to block the
178- // cluster lifecycle by default. Setting defaultAllHandlersToBlocking to false enforces that the test-extension
179- // automatically creates the ConfigMap with non-blocking preloaded responses.
180- defaultAllHandlersToBlocking := false
181- // select on the current namespace
182- // This is necessary so in CI this test doesn't influence other tests by enabling lifecycle hooks
183- // in other test namespaces.
184- namespaces := []string {namespace .Name }
185203 if input .DeployClusterClassInSeparateNamespace {
186- // Add the ClusterClass namespace, if the ClusterClass is deployed in a separate namespace.
187- namespaces = append ( namespaces , clusterClassNamespace . Name )
204+ variables [ "CLUSTER_CLASS_NAMESPACE" ] = clusterClassNamespace . Name
205+ By ( "Creating a cluster referencing a ClusterClass from another namespace" )
188206 }
189- extensionConfig := extensionConfig (input .ExtensionConfigName , input .ExtensionServiceNamespace , input .ExtensionServiceName , defaultAllHandlersToBlocking , namespaces ... )
190- Expect (input .BootstrapClusterProxy .GetClient ().Create (ctx ,
191- extensionConfig )).
192- To (Succeed (), "Failed to create the ExtensionConfig" )
193- }
194207
195- variables := map [string ]string {
196- // This is used to template the name of the ExtensionConfig into the ClusterClass.
197- "EXTENSION_CONFIG_NAME" : input .ExtensionConfigName ,
198- }
199- maps .Copy (variables , input .ClusterctlVariables )
208+ clusterctl .ApplyClusterTemplateAndWait (ctx , clusterctl.ApplyClusterTemplateAndWaitInput {
209+ ClusterProxy : input .BootstrapClusterProxy ,
210+ ConfigCluster : clusterctl.ConfigClusterInput {
211+ LogFolder : filepath .Join (input .ArtifactFolder , "clusters" , input .BootstrapClusterProxy .GetName ()),
212+ ClusterctlConfigPath : input .ClusterctlConfigPath ,
213+ ClusterctlVariables : variables ,
214+ KubeconfigPath : input .BootstrapClusterProxy .GetKubeconfigPath (),
215+ InfrastructureProvider : infrastructureProvider ,
216+ Flavor : flavor ,
217+ Namespace : namespace .Name ,
218+ ClusterName : clusterName ,
219+ KubernetesVersion : input .E2EConfig .MustGetVariable (KubernetesVersion ),
220+ ControlPlaneMachineCount : controlPlaneMachineCount ,
221+ WorkerMachineCount : workerMachineCount ,
222+ },
223+ ControlPlaneWaiters : input .ControlPlaneWaiters ,
224+ WaitForClusterIntervals : input .E2EConfig .GetIntervals (specName , "wait-cluster" ),
225+ WaitForControlPlaneIntervals : input .E2EConfig .GetIntervals (specName , "wait-control-plane" ),
226+ WaitForMachineDeployments : input .E2EConfig .GetIntervals (specName , "wait-worker-nodes" ),
227+ PostMachinesProvisioned : func () {
228+ if input .PostMachinesProvisioned != nil {
229+ input .PostMachinesProvisioned (input .BootstrapClusterProxy , namespace .Name , clusterName )
230+ }
231+ },
232+ }, clusterResources )
233+
234+ Byf ("Verify Cluster Available condition is true" )
235+ framework .VerifyClusterAvailable (ctx , framework.VerifyClusterAvailableInput {
236+ Getter : input .BootstrapClusterProxy .GetClient (),
237+ Name : clusterResources .Cluster .Name ,
238+ Namespace : clusterResources .Cluster .Namespace ,
239+ })
240+
241+ Byf ("Verify Machines Ready condition is true" )
242+ framework .VerifyMachinesReady (ctx , framework.VerifyMachinesReadyInput {
243+ Lister : input .BootstrapClusterProxy .GetClient (),
244+ Name : clusterResources .Cluster .Name ,
245+ Namespace : clusterResources .Cluster .Namespace ,
246+ })
247+
248+ By ("PASSED!" )
200249
201- if input .DeployClusterClassInSeparateNamespace {
202- variables ["CLUSTER_CLASS_NAMESPACE" ] = clusterClassNamespace .Name
203- By ("Creating a cluster referencing a ClusterClass from another namespace" )
204250 }
205-
206- clusterctl .ApplyClusterTemplateAndWait (ctx , clusterctl.ApplyClusterTemplateAndWaitInput {
207- ClusterProxy : input .BootstrapClusterProxy ,
208- ConfigCluster : clusterctl.ConfigClusterInput {
209- LogFolder : filepath .Join (input .ArtifactFolder , "clusters" , input .BootstrapClusterProxy .GetName ()),
210- ClusterctlConfigPath : input .ClusterctlConfigPath ,
211- ClusterctlVariables : variables ,
212- KubeconfigPath : input .BootstrapClusterProxy .GetKubeconfigPath (),
213- InfrastructureProvider : infrastructureProvider ,
214- Flavor : flavor ,
215- Namespace : namespace .Name ,
216- ClusterName : clusterName ,
217- KubernetesVersion : input .E2EConfig .MustGetVariable (KubernetesVersion ),
218- ControlPlaneMachineCount : controlPlaneMachineCount ,
219- WorkerMachineCount : workerMachineCount ,
220- },
221- ControlPlaneWaiters : input .ControlPlaneWaiters ,
222- WaitForClusterIntervals : input .E2EConfig .GetIntervals (specName , "wait-cluster" ),
223- WaitForControlPlaneIntervals : input .E2EConfig .GetIntervals (specName , "wait-control-plane" ),
224- WaitForMachineDeployments : input .E2EConfig .GetIntervals (specName , "wait-worker-nodes" ),
225- PostMachinesProvisioned : func () {
226- if input .PostMachinesProvisioned != nil {
227- input .PostMachinesProvisioned (input .BootstrapClusterProxy , namespace .Name , clusterName )
228- }
229- },
230- }, clusterResources )
231-
232- Byf ("Verify Cluster Available condition is true" )
233- framework .VerifyClusterAvailable (ctx , framework.VerifyClusterAvailableInput {
234- Getter : input .BootstrapClusterProxy .GetClient (),
235- Name : clusterResources .Cluster .Name ,
236- Namespace : clusterResources .Cluster .Namespace ,
237- })
238-
239- Byf ("Verify Machines Ready condition is true" )
240- framework .VerifyMachinesReady (ctx , framework.VerifyMachinesReadyInput {
241- Lister : input .BootstrapClusterProxy .GetClient (),
242- Name : clusterResources .Cluster .Name ,
243- Namespace : clusterResources .Cluster .Namespace ,
244- })
245-
246- By ("PASSED!" )
247251 })
248252
249253 AfterEach (func () {
0 commit comments