@@ -20,16 +20,15 @@ import (
2020 "context"
2121 "testing"
2222
23- certmanagerv1 "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
2423 "github.com/stretchr/testify/require"
2524
2625 corev1 "k8s.io/api/core/v1"
2726 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28- "k8s.io/apimachinery/pkg/runtime"
2927 ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client"
3028 ctrlruntimefakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
3129 "sigs.k8s.io/controller-runtime/pkg/reconcile"
3230
31+ "github.com/kcp-dev/kcp-operator/internal/controller/util"
3332 operatorv1alpha1 "github.com/kcp-dev/kcp-operator/sdk/apis/operator/v1alpha1"
3433)
3534
@@ -76,15 +75,14 @@ func TestReconciling(t *testing.T) {
7675 },
7776 }
7877
79- scheme := runtime .NewScheme ()
80- require .Nil (t , operatorv1alpha1 .AddToScheme (scheme ))
81- require .Nil (t , certmanagerv1 .AddToScheme (scheme ))
78+ scheme := util .GetTestScheme ()
8279
8380 for _ , testcase := range testcases {
8481 t .Run (testcase .name , func (t * testing.T ) {
8582 client := ctrlruntimefakeclient .
8683 NewClientBuilder ().
8784 WithScheme (scheme ).
85+ WithStatusSubresource (testcase .rootShard , testcase .frontProxy ).
8886 WithObjects (testcase .rootShard , testcase .frontProxy ).
8987 Build ()
9088
@@ -98,7 +96,7 @@ func TestReconciling(t *testing.T) {
9896 _ , err := controllerReconciler .Reconcile (ctx , reconcile.Request {
9997 NamespacedName : ctrlruntimeclient .ObjectKeyFromObject (testcase .frontProxy ),
10098 })
101- require .Nil (t , err )
99+ require .NoError (t , err )
102100 })
103101 }
104102}
0 commit comments