diff --git a/pkg/array/array_test.go b/pkg/array/array_test.go index 695e9b1e..ced7e012 100644 --- a/pkg/array/array_test.go +++ b/pkg/array/array_test.go @@ -185,10 +185,10 @@ func TestParseVolumeID(t *testing.T) { } volCap := getVolCap() - gotId, gotIp, protocol, err := array.ParseVolumeID(context.Background(), id, &array.PowerStoreArray{IP: ip, GlobalID: "gid1"}, volCap) + gotID, gotIP, protocol, err := array.ParseVolumeID(context.Background(), id, &array.PowerStoreArray{IP: ip, GlobalID: "gid1"}, volCap) assert.NoError(t, err) - assert.Equal(t, id, gotId) - assert.Equal(t, ip, gotIp) + assert.Equal(t, id, gotID) + assert.Equal(t, ip, gotIP) assert.Equal(t, protocol, "nfs") }) } diff --git a/pkg/common/common_test.go b/pkg/common/common_test.go index 8dfab373..99b90b2c 100644 --- a/pkg/common/common_test.go +++ b/pkg/common/common_test.go @@ -37,7 +37,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestCustomLogger(t *testing.T) { +func TestCustomLogger(_ *testing.T) { log.SetLevel(log.DebugLevel) lg := &common.CustomLogger{} ctx := context.Background() diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 2191ce88..26badc8e 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -964,7 +964,7 @@ func cacheMaximumVolumeSize(key string, value int64) { } // ControllerGetCapabilities returns list of capabilities that are supported by the driver. -func (s *Service) ControllerGetCapabilities(ctx context.Context, request *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) { +func (s *Service) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) { newCap := func(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability { return &csi.ControllerServiceCapability{ Type: &csi.ControllerServiceCapability_Rpc{ @@ -1327,7 +1327,7 @@ func (s *Service) RegisterAdditionalServers(server *grpc.Server) { } // ProbeController probes the controller service -func (s *Service) ProbeController(ctx context.Context, req *commonext.ProbeControllerRequest) (*commonext.ProbeControllerResponse, error) { +func (s *Service) ProbeController(_ context.Context, _ *commonext.ProbeControllerRequest) (*commonext.ProbeControllerResponse, error) { ready := new(wrappers.BoolValue) ready.Value = true rep := new(commonext.ProbeControllerResponse) diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index a4509d82..66903245 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -59,7 +59,7 @@ const ( validHostName = "csi-node-1a47a1b91c444a8a90193d8066669603" validHostID = "24aefac2-a796-47dc-886a-c73ff8c1a671" validClusterName = "localSystemName" - validRemoteVolId = "9f840c56-96e6-4de9-b5a3-27e7c20eaa77" + validRemoteVolID = "9f840c56-96e6-4de9-b5a3-27e7c20eaa77" validRemoteSystemName = "remoteName" validRemoteSystemID = "df7f804c-6373-4659-b197-36654d17979c" validRPO = "Five_Minutes" @@ -3797,7 +3797,7 @@ var _ = Describe("CSIControllerService", func() { StorageElementPairs: []gopowerstore.StorageElementPair{ { LocalStorageElementId: validBaseVolID, - RemoteStorageElementId: validRemoteVolId, + RemoteStorageElementId: validRemoteVolID, }, }, }, nil) @@ -3821,7 +3821,7 @@ var _ = Describe("CSIControllerService", func() { Expect(res).To(Equal( &csiext.CreateRemoteVolumeResponse{RemoteVolume: &csiext.Volume{ CapacityBytes: validVolSize, - VolumeId: validRemoteVolId + "/" + validRemoteSystemGlobalID + "/" + "iscsi", + VolumeId: validRemoteVolID + "/" + validRemoteSystemGlobalID + "/" + "iscsi", VolumeContext: map[string]string{ "remoteSystem": validClusterName, "managementAddress": secondValidID, diff --git a/pkg/controller/creator.go b/pkg/controller/creator.go index 9d8a258d..e77c760b 100644 --- a/pkg/controller/creator.go +++ b/pkg/controller/creator.go @@ -180,7 +180,7 @@ func setNFSCreateAttributes(reqParams map[string]string, createParams *gopowerst } // CheckSize validates that size is correct and returns size in bytes -func (*SCSICreator) CheckSize(ctx context.Context, cr *csi.CapacityRange, isAutoRoundOffFsSizeEnabled bool) (int64, error) { +func (*SCSICreator) CheckSize(_ context.Context, cr *csi.CapacityRange, _ bool) (int64, error) { minSize := cr.GetRequiredBytes() maxSize := cr.GetLimitBytes() @@ -204,7 +204,7 @@ func (*SCSICreator) CheckSize(ctx context.Context, cr *csi.CapacityRange, isAuto } // CheckName validates volume name -func (*SCSICreator) CheckName(ctx context.Context, name string) error { +func (*SCSICreator) CheckName(_ context.Context, name string) error { return volumeNameValidation(name) } @@ -372,7 +372,7 @@ type NfsCreator struct { } // CheckSize validates that size is correct and returns size in bytes -func (*NfsCreator) CheckSize(ctx context.Context, cr *csi.CapacityRange, isAutoRoundOffFsSizeEnabled bool) (int64, error) { +func (*NfsCreator) CheckSize(_ context.Context, cr *csi.CapacityRange, isAutoRoundOffFsSizeEnabled bool) (int64, error) { minSize := cr.GetRequiredBytes() maxSize := cr.GetLimitBytes() @@ -402,7 +402,7 @@ func (*NfsCreator) CheckSize(ctx context.Context, cr *csi.CapacityRange, isAutoR } // CheckName validates volume name -func (*NfsCreator) CheckName(ctx context.Context, name string) error { +func (*NfsCreator) CheckName(_ context.Context, name string) error { return volumeNameValidation(name) } diff --git a/pkg/controller/csi_extension_server_test.go b/pkg/controller/csi_extension_server_test.go index aacbde69..f44b6ba9 100644 --- a/pkg/controller/csi_extension_server_test.go +++ b/pkg/controller/csi_extension_server_test.go @@ -54,10 +54,10 @@ var _ = Describe("csi-extension-server", func() { When("nodeId is not provided ", func() { It("should return error", func() { - volId := []string{validBaseVolID} + volID := []string{validBaseVolID} req := &podmon.ValidateVolumeHostConnectivityRequest{ ArrayId: "default", - VolumeIds: volId, + VolumeIds: volID, NodeId: "", } _, err := ctrlSvc.ValidateVolumeHostConnectivity(context.Background(), req) @@ -67,10 +67,10 @@ var _ = Describe("csi-extension-server", func() { When("array status is not fetched so server will not respond ", func() { It("should return error", func() { - volId := []string{validBaseVolID} + volID := []string{validBaseVolID} req := &podmon.ValidateVolumeHostConnectivityRequest{ ArrayId: "default", - VolumeIds: volId, + VolumeIds: volID, NodeId: "csi-node-003c684ccb0c4ca0a9c99423563dfd2c-127.0.0.1", } clientMock.On("GetVolume", context.Background(), mock.Anything).Return(gopowerstore.Volume{ApplianceID: validApplianceID}, nil) @@ -111,9 +111,9 @@ var _ = Describe("csi-extension-server", func() { StatusCode: http.StatusInternalServerError, }, }) - volId := []string{validBaseVolID} + volID := []string{validBaseVolID} req := &podmon.ValidateVolumeHostConnectivityRequest{ - VolumeIds: volId, + VolumeIds: volID, NodeId: "csi-node-003c684ccb0c4ca0a9c99423563dfd2c-127.0.0.1", } common.APIPort = ":9028" @@ -127,7 +127,7 @@ var _ = Describe("csi-extension-server", func() { }) fmt.Printf("Starting server at port 9028\n") - go http.ListenAndServe(":9028", nil) + go net/http.ListenAndServe(":9028", nil) response, err := ctrlSvc.ValidateVolumeHostConnectivity(context.Background(), req) Expect(err).To(BeNil()) @@ -157,9 +157,9 @@ var _ = Describe("csi-extension-server", func() { resp2[5].TotalIops = 0.0 clientMock.On("PerformanceMetricsByVolume", context.Background(), mock.Anything, mock.Anything). Return(resp2, nil) - volId2 := []string{validBaseVolID} + volID2 := []string{validBaseVolID} req2 := &podmon.ValidateVolumeHostConnectivityRequest{ - VolumeIds: volId2, + VolumeIds: volID2, NodeId: "csi-node-003c684ccb0c4ca0a9c99423563dfd2c-127.0.0.1", }