Skip to content

Commit

Permalink
go vet
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderboltsid committed Feb 23, 2024
1 parent ae8e195 commit 77c94cd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
setupLog.Info("Initializing Nutanix Cluster API Infrastructure Provider", "Git Hash", gitCommitHash)

//nolint:staticcheck
diagnosticsOptions.MetricsBindAddr = metricsAddr
webhookServer := &webhook.DefaultServer{}

Expand Down
6 changes: 3 additions & 3 deletions pkg/client/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const (
statusSucceeded = "SUCCEEDED"
)

// WaitForTaskToSucceed will poll indefinitely every 2 seconds for the task with uuid to have status of "SUCCEEDED".
// The polling will not stop if the ctx is cancelled, it's only used for HTTP requests in the client.
// WaitForTaskToSucceed will poll every 2 seconds for the task with uuid to have status of "SUCCEEDED".
// The polling will stop if the ctx is cancelled, it's used for HTTP requests in the client and to control the polling.
// WaitForTaskToSucceed will exit immediately on an error getting the task.
func WaitForTaskToSucceed(ctx context.Context, conn *nutanixClientV3.Client, uuid string) error {
return wait.PollImmediateInfinite(pollingInterval, func() (done bool, err error) {
return wait.PollUntilContextCancel(ctx, pollingInterval, true, func(ctx context.Context) (done bool, err error) {
status, getErr := GetTaskStatus(ctx, conn, uuid)
return status == statusSucceeded, getErr
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/md_scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ var _ = Describe("When testing MachineDeployment scale up/down from 10 replicas
Namespace: namespace.Name,
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64Ptr(1),
WorkerMachineCount: pointer.Int64Ptr(10),
ControlPlaneMachineCount: pointer.Int64(1),
WorkerMachineCount: pointer.Int64(10),
},
ControlPlaneWaiters: input.ControlPlaneWaiters,
WaitForClusterIntervals: input.E2EConfig.GetIntervals(specName, "wait-cluster"),
WaitForControlPlaneIntervals: input.E2EConfig.GetIntervals(specName, "wait-control-plane"),
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
}, clusterResources)

Expect(clusterResources.MachineDeployments[0].Spec.Replicas).To(Equal(pointer.Int32Ptr(10)))
Expect(clusterResources.MachineDeployments[0].Spec.Replicas).To(Equal(pointer.Int32(10)))

By("Scaling the MachineDeployment out to 20")
framework.ScaleAndWaitMachineDeployment(ctx, framework.ScaleAndWaitMachineDeploymentInput{
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,16 @@ func (t testHelper) createUUIDNMT(ctx context.Context, clusterName, namespace st
MemorySize: resource.MustParse(defaultMemorySize),
Image: infrav1.NutanixResourceIdentifier{
Type: infrav1.NutanixIdentifierUUID,
UUID: pointer.StringPtr(imageUUID),
UUID: pointer.String(imageUUID),
},
Cluster: infrav1.NutanixResourceIdentifier{
Type: infrav1.NutanixIdentifierUUID,
UUID: pointer.StringPtr(clusterUUID),
UUID: pointer.String(clusterUUID),
},
Subnets: []infrav1.NutanixResourceIdentifier{
{
Type: infrav1.NutanixIdentifierUUID,
UUID: pointer.StringPtr(subnetUUID),
UUID: pointer.String(subnetUUID),
},
},
SystemDiskSize: resource.MustParse(defaultSystemDiskSize),
Expand Down Expand Up @@ -426,8 +426,8 @@ func (t testHelper) deployCluster(params deployClusterParams, clusterResources *
Namespace: params.namespace.Name,
ClusterName: params.clusterName,
KubernetesVersion: t.e2eConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64Ptr(1),
WorkerMachineCount: pointer.Int64Ptr(1),
ControlPlaneMachineCount: pointer.Int64(1),
WorkerMachineCount: pointer.Int64(1),
}

t.createClusterFromConfig(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
Expand All @@ -449,8 +449,8 @@ func (t testHelper) deployClusterAndWait(params deployClusterParams, clusterReso
Namespace: params.namespace.Name,
ClusterName: params.clusterName,
KubernetesVersion: t.e2eConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64Ptr(1),
WorkerMachineCount: pointer.Int64Ptr(1),
ControlPlaneMachineCount: pointer.Int64(1),
WorkerMachineCount: pointer.Int64(1),
}

clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
Expand Down Expand Up @@ -537,15 +537,15 @@ func (t testHelper) getNutanixResourceIdentifierFromEnv(envVarKey string) infrav
Expect(envVarValue).ToNot(BeEmpty(), "expected environment variable %s to be set", envVarKey)
return infrav1.NutanixResourceIdentifier{
Type: nameType,
Name: pointer.StringPtr(envVarValue),
Name: pointer.String(envVarValue),
}
}

func (t testHelper) getNutanixResourceIdentifierFromE2eConfig(variableKey string) infrav1.NutanixResourceIdentifier {
variableValue := t.getVariableFromE2eConfig(variableKey)
return infrav1.NutanixResourceIdentifier{
Type: nameType,
Name: pointer.StringPtr(variableValue),
Name: pointer.String(variableValue),
}
}

Expand Down

0 comments on commit 77c94cd

Please sign in to comment.