Skip to content

Commit

Permalink
Change IBMPowerVSClient type for better mocking
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Amulyam24 committed Feb 24, 2022
1 parent d83617b commit e89d71c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cloud/scope/powervs_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/powervs_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type PowerVSImageScope struct {
client client.Client
patchHelper *patch.Helper

IBMPowerVSClient *powervs.Service
IBMPowerVSClient powervs.PowerVS
IBMPowerVSImage *v1beta1.IBMPowerVSImage
}

Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloud/services/powervs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e89d71c

Please sign in to comment.