Skip to content

Commit deab125

Browse files
authored
Change IBMPowerVSClient type for better mocking (#577)
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 <[email protected]>
1 parent cb06a12 commit deab125

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

cloud/scope/powervs_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type PowerVSClusterScope struct {
5858
client client.Client
5959
patchHelper *patch.Helper
6060

61-
IBMPowerVSClient *powervs.Service
61+
IBMPowerVSClient powervs.PowerVS
6262
Cluster *clusterv1.Cluster
6363
IBMPowerVSCluster *v1beta1.IBMPowerVSCluster
6464
}

cloud/scope/powervs_image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type PowerVSImageScope struct {
5555
client client.Client
5656
patchHelper *patch.Helper
5757

58-
IBMPowerVSClient *powervs.Service
58+
IBMPowerVSClient powervs.PowerVS
5959
IBMPowerVSImage *v1beta1.IBMPowerVSImage
6060
}
6161

cloud/scope/powervs_machine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type PowerVSMachineScope struct {
6565
client client.Client
6666
patchHelper *patch.Helper
6767

68-
IBMPowerVSClient *powervs.Service
68+
IBMPowerVSClient powervs.PowerVS
6969
Cluster *clusterv1.Cluster
7070
Machine *clusterv1.Machine
7171
IBMPowerVSCluster *v1beta1.IBMPowerVSCluster

pkg/cloud/services/powervs/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (s *Service) GetAllNetwork() (*models.Networks, error) {
110110
}
111111

112112
// NewService returns a new service for the Power VS api client.
113-
func NewService(options ServiceOptions) (*Service, error) {
113+
func NewService(options ServiceOptions) (PowerVS, error) {
114114
auth, err := authenticator.GetAuthenticator()
115115
if err != nil {
116116
return nil, err

0 commit comments

Comments
 (0)