Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 65b39ae

Browse files
committed
lint fixes
1 parent abccd91 commit 65b39ae

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

pkg/handlers/nutanix/mutation/machinedetails/inject_control_plane.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ func (h *nutanixMachineDetailsControlPlanePatchHandler) Mutate(
139139
subnet := capxv1.NutanixResourceIdentifier{}
140140
if subnetCRE.Type == v1alpha1.NutanixIdentifierName {
141141
subnet.Type = capxv1.NutanixIdentifierName
142-
if subnetCRE.Name == nil || len(*subnetCRE.Name) == 0{
142+
if subnetCRE.Name == nil || *subnetCRE.Name == "" {
143143
continue
144144
}
145145
subnet.Name = subnetCRE.Name
146146
} else {
147147
subnet.Type = capxv1.NutanixIdentifierUUID
148-
if subnetCRE.UUID == nil || len(*subnetCRE.UUID) == 0{
148+
if subnetCRE.UUID == nil || *subnetCRE.UUID == "" {
149149
continue
150150
}
151151
subnet.UUID = subnetCRE.UUID

pkg/handlers/nutanix/mutation/machinedetails/inject_worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ func (h *nutanixMachineDetailsWorkerPatchHandler) Mutate(
128128
subnet := capxv1.NutanixResourceIdentifier{}
129129
if subnetCRE.Type == v1alpha1.NutanixIdentifierName {
130130
subnet.Type = capxv1.NutanixIdentifierName
131-
if subnetCRE.Name == nil || len(*subnetCRE.Name) == 0 {
131+
if subnetCRE.Name == nil || *subnetCRE.Name == "" {
132132
continue
133133
}
134134
subnet.Name = subnetCRE.Name
135135
} else {
136136
subnet.Type = capxv1.NutanixIdentifierUUID
137-
if subnetCRE.UUID == nil || len(*subnetCRE.UUID) == 0 {
137+
if subnetCRE.UUID == nil || *subnetCRE.UUID == "" {
138138
continue
139139
}
140140
subnet.UUID = subnetCRE.UUID

pkg/handlers/nutanix/mutation/machinedetails/variables_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import (
1515
)
1616

1717
func TestVariableValidation(t *testing.T) {
18+
testImageName := "fake-image"
19+
testPEClusterName := "fake-pe-cluster"
20+
testProject := "fake-project"
1821
capitest.ValidateDiscoverVariables(
1922
t,
2023
clusterconfig.MetaVariableName,
@@ -30,13 +33,22 @@ func TestVariableValidation(t *testing.T) {
3033
BootType: "legacy",
3134
VCPUSockets: 2,
3235
VCPUsPerSocket: 1,
33-
Image: v1alpha1.NutanixResourceIdentifier{},
34-
Cluster: v1alpha1.NutanixResourceIdentifier{},
36+
Image: v1alpha1.NutanixResourceIdentifier{
37+
Type: v1alpha1.NutanixIdentifierName,
38+
Name: &testImageName,
39+
},
40+
Cluster: v1alpha1.NutanixResourceIdentifier{
41+
Type: v1alpha1.NutanixIdentifierName,
42+
Name: &testPEClusterName,
43+
},
3544
MemorySize: "8Gi",
3645
SystemDiskSize: "40Gi",
3746
Subnets: []v1alpha1.NutanixResourceIdentifier{},
38-
Project: v1alpha1.NutanixResourceIdentifier{},
39-
GPUs: []v1alpha1.NutanixGPU{},
47+
Project: v1alpha1.NutanixResourceIdentifier{
48+
Type: v1alpha1.NutanixIdentifierName,
49+
Name: &testProject,
50+
},
51+
GPUs: []v1alpha1.NutanixGPU{},
4052
},
4153
},
4254
},

pkg/handlers/nutanix/mutation/metapatch_handler_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
nutanixclusterconfig "github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/clusterconfig"
2727
"github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/controlplaneendpoint"
2828
controlplaneendpointtests "github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/controlplaneendpoint/tests"
29-
"github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/machinedetails"
3029
"github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/prismcentralendpoint"
3130
prismcentralendpointtests "github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/prismcentralendpoint/tests"
3231
)
@@ -64,7 +63,6 @@ func TestGeneratePatches(t *testing.T) {
6463
prismcentralendpoint.VariableName,
6564
)
6665

67-
6866
auditpolicytests.TestGeneratePatches(
6967
t,
7068
metaPatchGeneratorFunc(mgr),

0 commit comments

Comments
 (0)