Merge pull request #107924 from gnufied/fix-reconciler-flake

fix flake in detach tests
This commit is contained in:
Kubernetes Prow Robot 2022-02-04 10:08:01 -08:00 committed by GitHub
commit 8f5a12d701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1084,7 +1084,6 @@ func (fv *FakeVolume) GetUnmountDeviceCallCount() int {
func (fv *FakeVolume) Detach(volumeName string, nodeName types.NodeName) error {
fv.Lock()
defer fv.Unlock()
fv.DetachCallCount++
node := string(nodeName)
volumeNodes, exist := fv.VolumesAttached[volumeName]
@ -1092,6 +1091,7 @@ func (fv *FakeVolume) Detach(volumeName string, nodeName types.NodeName) error {
return fmt.Errorf("trying to detach volume %q that is not attached to the node %q", volumeName, node)
}
fv.DetachCallCount++
if nodeName == FailDetachNode {
return fmt.Errorf("fail to detach volume %q to node %q", volumeName, nodeName)
}