Skip to content

Commit 5b292b5

Browse files
committed
Add NodeUnpublishVolume test for when the volume is missing
The spec mandates that such cases should return NOT_FOUND responses [1]. The mock driver already implements the right behavior. [1] https://github.com/container-storage-interface/spec/blob/4731db0e0bc53238b93850f43ab05d9355df0fd9/spec.md#nodeunpublishvolume-errors
1 parent 6e5433b commit 5b292b5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/sanity/node.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,21 @@ var _ = DescribeSanity("Node Service", func(sc *TestContext) {
241241
Expect(ok).To(BeTrue())
242242
Expect(serverError.Code()).To(Equal(codes.InvalidArgument))
243243
})
244+
245+
It("should fail when the volume is missing", func() {
246+
247+
_, err := c.NodeUnpublishVolume(
248+
context.Background(),
249+
&csi.NodeUnpublishVolumeRequest{
250+
VolumeId: sc.Config.IDGen.GenerateUniqueValidVolumeID(),
251+
TargetPath: sc.StagingPath,
252+
})
253+
Expect(err).To(HaveOccurred())
254+
255+
serverError, ok := status.FromError(err)
256+
Expect(ok).To(BeTrue())
257+
Expect(serverError.Code()).To(Equal(codes.NotFound))
258+
})
244259
})
245260

246261
Describe("NodeStageVolume", func() {

0 commit comments

Comments
 (0)