Skip to content

Commit

Permalink
test: add ut
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Jan 13, 2025
1 parent 0e4e10c commit 4d2c9d5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/smb/nodeserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,34 @@ func TestNodePublishVolume(t *testing.T) {
Readonly: true},
expectedErr: testutil.TestError{},
},
{
desc: "[Error] failed to create ephemeral Volume",
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
TargetPath: targetTest,
StagingTargetPath: sourceTest,
Readonly: true,
VolumeContext: map[string]string{ephemeralField: "true"},
},
expectedErr: testutil.TestError{
DefaultError: status.Error(codes.InvalidArgument, "source field is missing, current context: map[csi.storage.k8s.io/ephemeral:true secretnamespace:]"),
},
},
{
desc: "[Success] Valid request with ephemeral Volume",
req: &csi.NodePublishVolumeRequest{VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
VolumeId: "vol_1",
TargetPath: targetTest,
StagingTargetPath: sourceTest,
Readonly: true,
VolumeContext: map[string]string{
ephemeralField: "true",
sourceField: "source",
podNamespaceField: "podnamespace",
},
},
expectedErr: testutil.TestError{},
},
}

// Setup
Expand Down

0 comments on commit 4d2c9d5

Please sign in to comment.