Skip to content

Commit 2df9ddc

Browse files
committed
mock: avoid "not found" error in ControllerUnpublishVolume
The behavior of the external-attacher recently changed (kubernetes-csi/external-attacher#165) such that it now treats "not found" as real error. The effect was that some Kubernetes E2E tests (like "CSI mock volume CSI workload information using mock driver should not be passed when podInfoOnMount=false") sometimes ran for over 2 minutes, just waiting for detatch. That the test then proceeds without marking the test as failed is a bug in the test cleanup code which will be fixed. This slowdown is not deterministic: sometimes the detach is done early enough while the volume still exists. With this change, the same test completes in under 30 seconds.
1 parent 1675a8e commit 2df9ddc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mock/service/controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ func (s *service) ControllerUnpublishVolume(
244244

245245
i, v := s.findVolNoLock("id", req.VolumeId)
246246
if i < 0 {
247-
return nil, status.Error(codes.NotFound, req.VolumeId)
247+
// Not an error: a non-existent volume is not published.
248+
// See also https://github.com/kubernetes-csi/external-attacher/pull/165
249+
return &csi.ControllerUnpublishVolumeResponse{}, nil
248250
}
249251

250252
// devPathKey is the key in the volume's attributes that is set to a

0 commit comments

Comments
 (0)