@@ -83,6 +83,7 @@ func TestNutanixClusterReconciler(t *testing.T) {
8383 UID : utilruntime .NewUUID (),
8484 },
8585 Spec : infrav1.NutanixClusterSpec {
86+ ControlPlaneEndpoint : capiv1.APIEndpoint {},
8687 PrismCentral : & credentialTypes.NutanixPrismEndpoint {
8788 // Adding port info to override default value (0)
8889 Port : 9440 ,
@@ -245,6 +246,7 @@ func TestNutanixClusterReconciler(t *testing.T) {
245246 Namespace : corev1 .NamespaceDefault ,
246247 },
247248 Spec : infrav1.NutanixClusterSpec {
249+ ControlPlaneEndpoint : capiv1.APIEndpoint {},
248250 PrismCentral : & credentialTypes.NutanixPrismEndpoint {
249251 // Adding port info to override default value (0)
250252 Port : 9440 ,
@@ -409,6 +411,7 @@ func TestNutanixClusterReconciler(t *testing.T) {
409411 Namespace : "default" ,
410412 },
411413 Spec : infrav1.NutanixClusterSpec {
414+ ControlPlaneEndpoint : capiv1.APIEndpoint {},
412415 PrismCentral : & credentialTypes.NutanixPrismEndpoint {
413416 // Adding port info to override default value (0)
414417 Port : 9440 ,
@@ -471,6 +474,7 @@ func TestNutanixClusterReconciler(t *testing.T) {
471474 Namespace : "default" ,
472475 },
473476 Spec : infrav1.NutanixClusterSpec {
477+ ControlPlaneEndpoint : capiv1.APIEndpoint {},
474478 PrismCentral : & credentialTypes.NutanixPrismEndpoint {
475479 // Adding port info to override default value (0)
476480 Port : 9440 ,
@@ -505,6 +509,7 @@ func TestNutanixClusterReconciler(t *testing.T) {
505509 Namespace : "default" ,
506510 },
507511 Spec : infrav1.NutanixClusterSpec {
512+ ControlPlaneEndpoint : capiv1.APIEndpoint {},
508513 PrismCentral : & credentialTypes.NutanixPrismEndpoint {
509514 // Adding port info to override default value (0)
510515 Port : 9440 ,
@@ -530,34 +535,23 @@ func TestNutanixClusterReconciler(t *testing.T) {
530535 })
531536 })
532537
533- Context ("Delete credentials ref reconcile failed: PrismCentral Info is null" , func () {
538+ Context ("NutanixCluster creation failed: PrismCentral Info is null" , func () {
534539 It ("Should not return error" , func () {
535540 ctx := context .Background ()
536- reconciler := & NutanixClusterReconciler {
537- Client : k8sClient ,
538- Scheme : runtime .NewScheme (),
539- }
540541
541542 ntnxCluster := & infrav1.NutanixCluster {
542543 ObjectMeta : metav1.ObjectMeta {
543544 Name : "test" ,
544545 Namespace : "default" ,
545546 },
546547 Spec : infrav1.NutanixClusterSpec {
547- PrismCentral : nil ,
548+ ControlPlaneEndpoint : capiv1.APIEndpoint {},
549+ PrismCentral : nil ,
548550 },
549551 }
550552
551553 // Create the NutanixCluster object
552- g .Expect (k8sClient .Create (ctx , ntnxCluster )).To (Succeed ())
553- defer func () {
554- err := k8sClient .Delete (ctx , ntnxCluster )
555- Expect (err ).NotTo (HaveOccurred ())
556- }()
557-
558- // Reconile Delete credential ref
559- err := reconciler .reconcileCredentialRefDelete (ctx , ntnxCluster )
560- g .Expect (err ).NotTo (HaveOccurred ())
554+ g .Expect (k8sClient .Create (ctx , ntnxCluster )).NotTo (Succeed ())
561555 })
562556 })
563557 })
0 commit comments