@@ -23,10 +23,12 @@ import (
2323
2424 . "github.com/onsi/gomega"
2525 corev1 "k8s.io/api/core/v1"
26+ apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2627 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2728 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2829 "k8s.io/client-go/kubernetes/scheme"
2930 clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
31+ "sigs.k8s.io/cluster-api/controllers/external"
3032 capierrors "sigs.k8s.io/cluster-api/errors"
3133 "sigs.k8s.io/controller-runtime/pkg/client"
3234 "sigs.k8s.io/controller-runtime/pkg/client/fake"
@@ -50,7 +52,7 @@ func TestClusterReconcilePhases(t *testing.T) {
5052 },
5153 InfrastructureRef : & corev1.ObjectReference {
5254 APIVersion : "infrastructure.cluster.x-k8s.io/v1alpha3" ,
53- Kind : "InfrastructureConfig " ,
55+ Kind : "InfrastructureMachine " ,
5456 Name : "test" ,
5557 },
5658 },
@@ -76,7 +78,7 @@ func TestClusterReconcilePhases(t *testing.T) {
7678 name : "returns no error if infra config is marked for deletion" ,
7779 cluster : cluster ,
7880 infraRef : map [string ]interface {}{
79- "kind" : "InfrastructureConfig " ,
81+ "kind" : "InfrastructureMachine " ,
8082 "apiVersion" : "infrastructure.cluster.x-k8s.io/v1alpha3" ,
8183 "metadata" : map [string ]interface {}{
8284 "name" : "test" ,
@@ -90,7 +92,7 @@ func TestClusterReconcilePhases(t *testing.T) {
9092 name : "returns no error if infrastructure is marked ready on cluster" ,
9193 cluster : cluster ,
9294 infraRef : map [string ]interface {}{
93- "kind" : "InfrastructureConfig " ,
95+ "kind" : "InfrastructureMachine " ,
9496 "apiVersion" : "infrastructure.cluster.x-k8s.io/v1alpha3" ,
9597 "metadata" : map [string ]interface {}{
9698 "name" : "test" ,
@@ -104,7 +106,7 @@ func TestClusterReconcilePhases(t *testing.T) {
104106 name : "returns error if infrastructure has the paused annotation" ,
105107 cluster : cluster ,
106108 infraRef : map [string ]interface {}{
107- "kind" : "InfrastructureConfig " ,
109+ "kind" : "InfrastructureMachine " ,
108110 "apiVersion" : "infrastructure.cluster.x-k8s.io/v1alpha3" ,
109111 "metadata" : map [string ]interface {}{
110112 "name" : "test" ,
@@ -122,13 +124,14 @@ func TestClusterReconcilePhases(t *testing.T) {
122124 t .Run (tt .name , func (t * testing.T ) {
123125 g := NewWithT (t )
124126 g .Expect (clusterv1 .AddToScheme (scheme .Scheme )).To (Succeed ())
127+ g .Expect (apiextensionsv1 .AddToScheme (scheme .Scheme )).To (Succeed ())
125128
126129 var c client.Client
127130 if tt .infraRef != nil {
128131 infraConfig := & unstructured.Unstructured {Object : tt .infraRef }
129- c = fake .NewFakeClientWithScheme (scheme .Scheme , tt .cluster , infraConfig )
132+ c = fake .NewFakeClientWithScheme (scheme .Scheme , external . TestGenericInfrastructureCRD , tt .cluster , infraConfig )
130133 } else {
131- c = fake .NewFakeClientWithScheme (scheme .Scheme , tt .cluster )
134+ c = fake .NewFakeClientWithScheme (scheme .Scheme , external . TestGenericInfrastructureCRD , tt .cluster )
132135 }
133136 r := & ClusterReconciler {
134137 Client : c ,
0 commit comments