Fix flake associated with time out volumes

This test is suspectible to flakes because sometimes
while we verify if volume is attached to a node, reconciler
loop can turn second time and it can confirm the volume as attached.
k3s-v1.15.3
Hemant Kumar 2019-05-23 13:33:37 -04:00
parent b533613233
commit 4d481a0f29
1 changed files with 5 additions and 0 deletions

View File

@ -907,6 +907,11 @@ func (fv *FakeVolume) Attach(spec *Spec, nodeName types.NodeName) (string, error
if nodeName == UncertainAttachNode {
return "/dev/vdb-test", nil
}
// even if volume was previously attached to time out, we need to keep returning error
// so as reconciler can not confirm this volume as attached.
if nodeName == TimeoutAttachNode {
return "", fmt.Errorf("Timed out to attach volume %q to node %q", volumeName, nodeName)
}
if volumeNode == nodeName || volumeNode == MultiAttachNode || nodeName == MultiAttachNode {
return "/dev/vdb-test", nil
}