Repository: skupperproject/skupper
Pull request #1499 (2024-06-06 16:58:10)

update client for mock


Patch:
diff --git a/api/types/client.go b/api/types/client.go
index 735665cb..da940be7 100644
--- a/api/types/client.go
+++ b/api/types/client.go
@@ -359,7 +359,7 @@ type VanClientInterface interface {
 	GetConsoleUrl(namespace string) (string, error)
 	GetKubeClient() kubernetes.Interface
 	GetDynamicClient() dynamic.Interface
-	GetDiscoveryClient() *discovery.DiscoveryClient
+	GetDiscoveryClient() discovery.DiscoveryInterface
 	GetRouteClient() routev1client.RouteV1Interface
 	GetRouteInterface() openshiftroute.Interface
 	GetSkupperClient() skupperclient.Interface
diff --git a/client/client.go b/client/client.go
index afe3ba08..5dc26e14 100644
--- a/client/client.go
+++ b/client/client.go
@@ -40,7 +40,7 @@ type VanClient struct {
 	OCAppsClient    openshiftapps.Interface
 	RestConfig      *restclient.Config
 	DynamicClient   dynamic.Interface
-	DiscoveryClient *discovery.DiscoveryClient
+	DiscoveryClient discovery.DiscoveryInterface
 	skupperClient   skupperclient.Interface
 	LinkHandler     domain.LinkHandler
 }
@@ -57,7 +57,7 @@ func (cli *VanClient) GetDynamicClient() dynamic.Interface {
 	return cli.DynamicClient
 }
 
-func (cli *VanClient) GetDiscoveryClient() *discovery.DiscoveryClient {
+func (cli *VanClient) GetDiscoveryClient() discovery.DiscoveryInterface {
 	return cli.DiscoveryClient
 }
 
diff --git a/pkg/kube/clients.go b/pkg/kube/clients.go
index 7ae80a6a..354d1e99 100644
--- a/pkg/kube/clients.go
+++ b/pkg/kube/clients.go
@@ -27,7 +27,7 @@ import (
 type Clients interface {
 	GetKubeClient() kubernetes.Interface
 	GetDynamicClient() dynamic.Interface
-	GetDiscoveryClient() *discovery.DiscoveryClient
+	GetDiscoveryClient() discovery.DiscoveryInterface
 	GetRouteInterface() openshiftroute.Interface
 	GetRouteClient() routev1client.RouteV1Interface
 	GetSkupperClient() skupperclient.Interface
diff --git a/pkg/kube/controller.go b/pkg/kube/controller.go
index cebdf70a..ca8690ff 100644
--- a/pkg/kube/controller.go
+++ b/pkg/kube/controller.go
@@ -82,7 +82,7 @@ type Controller struct {
 	//routeClient     *routev1client.RouteV1Client
 	routeClient     openshiftroute.Interface
 	dynamicClient   dynamic.Interface
-	discoveryClient *discovery.DiscoveryClient
+	discoveryClient discovery.DiscoveryInterface
 	skupperClient   skupperclient.Interface
 	queue           workqueue.RateLimitingInterface
 	resync          time.Duration
@@ -110,7 +110,7 @@ func (c *Controller) GetDynamicClient() dynamic.Interface {
 	return c.dynamicClient
 }
 
-func (c *Controller) GetDiscoveryClient() *discovery.DiscoveryClient {
+func (c *Controller) GetDiscoveryClient() discovery.DiscoveryInterface {
 	return c.discoveryClient
 }
 
diff --git a/pkg/kube/ingress.go b/pkg/kube/ingress.go
index 99278550..8a02e473 100644
--- a/pkg/kube/ingress.go
+++ b/pkg/kube/ingress.go
@@ -434,7 +434,7 @@ func (r *IngressRoute) toUntypedRule() interface{} {
 	}
 }
 
-func useV1API(dc *discovery.DiscoveryClient) bool {
+func useV1API(dc discovery.DiscoveryInterface) bool {
 	if dc == nil {
 		return false
 	}


Test patch:
diff --git a/pkg/kube/site/context_test.go b/pkg/kube/site/context_test.go
index bedda65d..8cde10b9 100644
--- a/pkg/kube/site/context_test.go
+++ b/pkg/kube/site/context_test.go
@@ -6,6 +6,7 @@ import (
 	"reflect"
 	"testing"
 
+	openshiftroute "github.com/openshift/client-go/route/clientset/versioned"
 	routev1client "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1"
 	"gotest.tools/assert"
 	corev1 "k8s.io/api/core/v1"
@@ -20,6 +21,7 @@ import (
 
 	"github.com/skupperproject/skupper/api/types"
 	"github.com/skupperproject/skupper/pkg/event"
+	skupperclient "github.com/skupperproject/skupper/pkg/generated/client/clientset/versioned"
 	"github.com/skupperproject/skupper/pkg/kube/resolver"
 	"github.com/skupperproject/skupper/pkg/qdr"
 )
@@ -37,11 +39,19 @@ func (*TestClient) GetDynamicClient() dynamic.Interface {
 	return nil
 }
 
-func (*TestClient) GetDiscoveryClient() *discovery.DiscoveryClient {
+func (*TestClient) GetDiscoveryClient() discovery.DiscoveryInterface {
 	return nil
 }
 
-func (*TestClient) GetRouteClient() *routev1client.RouteV1Client {
+func (*TestClient) GetRouteClient() routev1client.RouteV1Interface {
+	return nil
+}
+
+func (*TestClient) GetRouteInterface() openshiftroute.Interface {
+	return nil
+}
+
+func (*TestClient) GetSkupperClient() skupperclient.Interface {
 	return nil
 }