Skip to content

Commit

Permalink
Add encryptInTransit failure test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
wongma7 committed Jun 30, 2020
1 parent 2a66813 commit 548db11
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions pkg/driver/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,43 @@ func TestNodePublishVolume(t *testing.T) {
message: "volume ID 'fs-abc123::invalid-id' has an invalid access point ID 'invalid-id': Expected it to be of the form 'fsap-...'",
},
},
{
name: "fail: tls in mount options and encryptInTransit false volume context",
req: &csi.NodePublishVolumeRequest{
VolumeId: volumeId,
VolumeCapability: &csi.VolumeCapability{
AccessType: &csi.VolumeCapability_Mount{
Mount: &csi.VolumeCapability_MountVolume{
MountFlags: []string{"tls"},
},
},
AccessMode: &csi.VolumeCapability_AccessMode{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
},
},
TargetPath: targetPath,
VolumeContext: map[string]string{"encryptInTransit": "false"},
},
expectMakeDir: false,
expectError: errtyp{
code: "InvalidArgument",
message: "Found tls in mountOptions but encryptInTransit is false",
},
},
{
name: "fail: encryptInTransit invalid boolean value volume context",
req: &csi.NodePublishVolumeRequest{
VolumeId: volumeId,
VolumeCapability: stdVolCap,
TargetPath: targetPath,
VolumeContext: map[string]string{"encryptInTransit": "asdf"},
},
expectMakeDir: false,
expectError: errtyp{
code: "InvalidArgument",
message: "Volume context property \"encryptInTransit\" must be a boolean value: strconv.ParseBool: parsing \"asdf\": invalid syntax",
},
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 548db11

Please sign in to comment.