Skip to content

Commit

Permalink
remove commented lines and add functional comments
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Ganesh <rahulgab@amazon.com>
  • Loading branch information
Rahul Ganesh committed Sep 18, 2023
1 parent 6d38e3b commit 01e748d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pkg/executables/govc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ func (g *Govc) GetResourcePoolInfo(ctx context.Context, datacenter, resourcepool
return poolInfo, nil
}

// helper function that parses the resource pool response and returns memory requirements.
// getPoolInfo parses resource pool response and returns memory requirements.
func getPoolInfo(rp *resourcePool) (map[string]int, error) {
memoryUsed, err := getValueFromString(rp.memoryUsage)
if err != nil {
Expand All @@ -1207,6 +1207,7 @@ func getPoolInfo(rp *resourcePool) (map[string]int, error) {
return poolInfo, nil
}

// getValueFromString cleans the input string and returns the extracted numerical value.
func getValueFromString(str string) (int, error) {
splitResponse := strings.Split(strings.TrimSpace(str), " ")
nonNumericRegex := regexp.MustCompile(`[^0-9- ]+`)
Expand Down
4 changes: 0 additions & 4 deletions pkg/providers/vsphere/vsphere_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1871,10 +1871,6 @@ func TestSetupAndValidateUpgradeClusterSameMachineConfigforCPandEtcd(t *testing.
for _, mc := range clusterSpec.VSphereMachineConfigs {
kubectl.EXPECT().GetEksaVSphereMachineConfig(ctx, gomock.Any(), cluster.KubeconfigFile, clusterSpec.Cluster.GetNamespace()).Return(mc, nil).AnyTimes()
}
// resourcePoolResponse := map[string]int{
// "Memory_Available": -1,
// }
// provider.govc.EXPECT().GetResourcePoolInfo(tt.ctx, tt.clusterSpec.VSphereDatacenter.Spec.Datacenter, tt.clusterSpec.VSphereMachineConfigs[controlPlaneMachineConfigName].Spec.ResourcePool).Return(resourcePoolResponse, nil)
err := provider.SetupAndValidateUpgradeCluster(ctx, cluster, clusterSpec, clusterSpec)
if err != nil {
t.Fatalf("unexpected failure %v", err)
Expand Down

0 comments on commit 01e748d

Please sign in to comment.