Skip to content

Commit

Permalink
chore: fix govet
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Nov 22, 2024
1 parent 24cd1f1 commit 1715f7e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 50 deletions.
12 changes: 6 additions & 6 deletions pkg/smb/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,30 +317,30 @@ func TestValidateVolumeCapabilities(t *testing.T) {

tests := []struct {
desc string
req csi.ValidateVolumeCapabilitiesRequest
req *csi.ValidateVolumeCapabilitiesRequest
expectedErr error
}{
{
desc: "Volume ID missing",
req: csi.ValidateVolumeCapabilitiesRequest{},
req: &csi.ValidateVolumeCapabilitiesRequest{},
expectedErr: status.Error(codes.InvalidArgument, "Volume ID missing in request"),
},
{
desc: "Volume capabilities missing",
req: csi.ValidateVolumeCapabilitiesRequest{VolumeId: "vol_1"},
req: &csi.ValidateVolumeCapabilitiesRequest{VolumeId: "vol_1"},
expectedErr: status.Error(codes.InvalidArgument, "volume capabilities missing in request"),
},
{
desc: "block volume capability not supported",
req: csi.ValidateVolumeCapabilitiesRequest{
req: &csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1",
VolumeCapabilities: blockVolCap,
},
expectedErr: status.Error(codes.InvalidArgument, "block volume capability not supported"),
},
{
desc: "Valid request",
req: csi.ValidateVolumeCapabilitiesRequest{
req: &csi.ValidateVolumeCapabilitiesRequest{
VolumeId: "vol_1#f5713de20cde511e8ba4900#fileshare#diskname#",
VolumeCapabilities: mountVolCap,
},
Expand All @@ -349,7 +349,7 @@ func TestValidateVolumeCapabilities(t *testing.T) {
}

for _, test := range tests {
_, err := d.ValidateVolumeCapabilities(context.Background(), &test.req)
_, err := d.ValidateVolumeCapabilities(context.Background(), test.req)
if !reflect.DeepEqual(err, test.expectedErr) {
t.Errorf("[test: %s] Unexpected error: %v, expected error: %v", test.desc, err, test.expectedErr)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/smb/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeSta
return nil, status.Errorf(codes.Internal, "%v", err)
}
if cache != nil {
resp := cache.(csi.NodeGetVolumeStatsResponse)
resp := cache.(*csi.NodeGetVolumeStatsResponse)
klog.V(6).Infof("NodeGetVolumeStats: volume stats for volume %s path %s is cached", req.VolumeId, req.VolumePath)
return &resp, nil
return resp, nil
}

if _, err := os.Lstat(req.VolumePath); err != nil {
Expand Down Expand Up @@ -365,7 +365,7 @@ func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeSta
}

// cache the volume stats per volume
d.volStatsCache.Set(req.VolumeId, resp)
d.volStatsCache.Set(req.VolumeId, &resp)
return &resp, err
}

Expand Down
Loading

0 comments on commit 1715f7e

Please sign in to comment.