From e89d71c01e965e416db449d1ec6306d67325688a Mon Sep 17 00:00:00 2001 From: Amulyam24 Date: Thu, 24 Feb 2022 16:50:07 +0530 Subject: [PATCH] Change IBMPowerVSClient type for better mocking PowerVS client would be mocked for unit tests. gomock expects the mocked type to be an interface, hence change the IBMPowerVSClient to be of type PowerVS. Signed-off-by: Amulyam24 --- cloud/scope/powervs_cluster.go | 2 +- cloud/scope/powervs_image.go | 2 +- cloud/scope/powervs_machine.go | 2 +- pkg/cloud/services/powervs/service.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cloud/scope/powervs_cluster.go b/cloud/scope/powervs_cluster.go index c2cafbf20..00b4f7548 100644 --- a/cloud/scope/powervs_cluster.go +++ b/cloud/scope/powervs_cluster.go @@ -58,7 +58,7 @@ type PowerVSClusterScope struct { client client.Client patchHelper *patch.Helper - IBMPowerVSClient *powervs.Service + IBMPowerVSClient powervs.PowerVS Cluster *clusterv1.Cluster IBMPowerVSCluster *v1beta1.IBMPowerVSCluster } diff --git a/cloud/scope/powervs_image.go b/cloud/scope/powervs_image.go index c01cc9343..0e8fbad99 100644 --- a/cloud/scope/powervs_image.go +++ b/cloud/scope/powervs_image.go @@ -55,7 +55,7 @@ type PowerVSImageScope struct { client client.Client patchHelper *patch.Helper - IBMPowerVSClient *powervs.Service + IBMPowerVSClient powervs.PowerVS IBMPowerVSImage *v1beta1.IBMPowerVSImage } diff --git a/cloud/scope/powervs_machine.go b/cloud/scope/powervs_machine.go index d9c964f58..88fe4a85f 100644 --- a/cloud/scope/powervs_machine.go +++ b/cloud/scope/powervs_machine.go @@ -65,7 +65,7 @@ type PowerVSMachineScope struct { client client.Client patchHelper *patch.Helper - IBMPowerVSClient *powervs.Service + IBMPowerVSClient powervs.PowerVS Cluster *clusterv1.Cluster Machine *clusterv1.Machine IBMPowerVSCluster *v1beta1.IBMPowerVSCluster diff --git a/pkg/cloud/services/powervs/service.go b/pkg/cloud/services/powervs/service.go index 95355aa5c..db811756f 100644 --- a/pkg/cloud/services/powervs/service.go +++ b/pkg/cloud/services/powervs/service.go @@ -110,7 +110,7 @@ func (s *Service) GetAllNetwork() (*models.Networks, error) { } // NewService returns a new service for the Power VS api client. -func NewService(options ServiceOptions) (*Service, error) { +func NewService(options ServiceOptions) (PowerVS, error) { auth, err := authenticator.GetAuthenticator() if err != nil { return nil, err