File tree 3 files changed +23
-4
lines changed
3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ func TestMyDriverWithCustomTargetPaths(t *testing.T) {
15
15
var createTargetDirCalls , createStagingDirCalls ,
16
16
removeTargetDirCalls , removeStagingDirCalls int
17
17
18
- wantCreateTargetCalls := 4
19
- wantCreateStagingCalls := 4
20
- wantRemoveTargetCalls := 4
21
- wantRemoveStagingCalls := 4
18
+ wantCreateTargetCalls := 5
19
+ wantCreateStagingCalls := 5
20
+ wantRemoveTargetCalls := 5
21
+ wantRemoveStagingCalls := 5
22
22
23
23
// tmpPath could be a CO specific directory under which all the target dirs
24
24
// are created. For k8s, it could be /var/lib/kubelet/pods under which the
Original file line number Diff line number Diff line change @@ -140,6 +140,10 @@ func (s *service) NodePublishVolume(
140
140
return nil , status .Error (codes .InvalidArgument , "Volume ID cannot be empty" )
141
141
}
142
142
143
+ if len (req .GetStagingTargetPath ()) == 0 {
144
+ return nil , status .Error (codes .FailedPrecondition , "StagingTarget Path cannot be empty" )
145
+ }
146
+
143
147
if len (req .GetTargetPath ()) == 0 {
144
148
return nil , status .Error (codes .InvalidArgument , "Target Path cannot be empty" )
145
149
}
Original file line number Diff line number Diff line change @@ -392,6 +392,21 @@ var _ = DescribeSanity("Node Service", func(sc *TestContext) {
392
392
Expect (serverError .Code ()).To (Equal (codes .InvalidArgument ))
393
393
})
394
394
395
+ It ("should fail when no staging target path is provided" , func () {
396
+ if ! nodeStageSupported {
397
+ Skip ("STAGE_UNSTAGE_VOLUME not supported" )
398
+ }
399
+
400
+ req .StagingTargetPath = ""
401
+
402
+ _ , err := c .NodePublishVolume (context .Background (), req )
403
+ Expect (err ).To (HaveOccurred ())
404
+
405
+ serverError , ok := status .FromError (err )
406
+ Expect (ok ).To (BeTrue ())
407
+ Expect (serverError .Code ()).To (Equal (codes .FailedPrecondition ))
408
+ })
409
+
395
410
It ("should fail when no volume capability is provided" , func () {
396
411
req .VolumeCapability = nil
397
412
You can’t perform that action at this time.
0 commit comments