Skip to content

Commit d65535c

Browse files
authored
Adding UT for powervs_machine.go (#1927)
1 parent 1283fe8 commit d65535c

File tree

3 files changed

+1508
-88
lines changed

3 files changed

+1508
-88
lines changed

cloud/scope/common_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ limitations under the License.
1717
package scope
1818

1919
import (
20+
"github.com/IBM-Cloud/power-go-client/power/models"
2021
"github.com/IBM/go-sdk-core/v5/core"
2122
corev1 "k8s.io/api/core/v1"
2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24+
"k8s.io/utils/ptr"
2325
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
2426

2527
infrav1beta2 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta2"
@@ -88,3 +90,15 @@ func newBootstrapSecret(clusterName, machineName string) *corev1.Secret {
8890
},
8991
}
9092
}
93+
94+
func newDHCPServerDetails(serverID, leaseIP, instanceMac string) *models.DHCPServerDetail {
95+
return &models.DHCPServerDetail{
96+
ID: ptr.To(serverID),
97+
Leases: []*models.DHCPServerLeases{
98+
{
99+
InstanceIP: ptr.To(leaseIP),
100+
InstanceMacAddress: ptr.To(instanceMac),
101+
},
102+
},
103+
}
104+
}

cloud/scope/powervs_machine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ func (m *PowerVSMachineScope) CreateVPCLoadBalancerPoolMember() (*vpcv1.LoadBala
10051005
if val, ok := m.IBMPowerVSCluster.Status.LoadBalancers[lb.Name]; ok {
10061006
lbID = val.ID
10071007
} else {
1008-
return nil, fmt.Errorf("failed to find VPC load balancer ID ")
1008+
return nil, fmt.Errorf("failed to find VPC load balancer ID")
10091009
}
10101010
loadBalancer, _, err := m.IBMVPCClient.GetLoadBalancer(&vpcv1.GetLoadBalancerOptions{
10111011
ID: lbID,

0 commit comments

Comments
 (0)