Skip to content

Commit

Permalink
Added changes related to golint
Browse files Browse the repository at this point in the history
  • Loading branch information
tssushma committed Dec 26, 2023
1 parent 63e6770 commit 91f74d3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions pkg/array/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -3797,7 +3797,7 @@ var _ = Describe("CSIControllerService", func() {
StorageElementPairs: []gopowerstore.StorageElementPair{
{
LocalStorageElementId: validBaseVolID,
RemoteStorageElementId: validRemoteVolId,
RemoteStorageElementId: validRemoteVolID,
},
},
}, nil)
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
}

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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)
}

Expand Down
18 changes: 9 additions & 9 deletions pkg/controller/csi_extension_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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)

Check failure on line 130 in pkg/controller/csi_extension_server_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected / at end of statement (typecheck)

Check failure on line 130 in pkg/controller/csi_extension_server_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected / at end of statement (typecheck)

Check failure on line 130 in pkg/controller/csi_extension_server_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected / at end of statement (typecheck)

Check failure on line 130 in pkg/controller/csi_extension_server_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected / at end of statement (typecheck)

Check failure on line 130 in pkg/controller/csi_extension_server_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected / at end of statement (typecheck)

response, err := ctrlSvc.ValidateVolumeHostConnectivity(context.Background(), req)
Expect(err).To(BeNil())
Expand Down Expand Up @@ -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",
}

Expand Down

0 comments on commit 91f74d3

Please sign in to comment.