Skip to content

Commit 4d481a0

Browse files
committed
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.
1 parent b533613 commit 4d481a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/volume/testing/testing.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,11 @@ func (fv *FakeVolume) Attach(spec *Spec, nodeName types.NodeName) (string, error
907907
if nodeName == UncertainAttachNode {
908908
return "/dev/vdb-test", nil
909909
}
910+
// even if volume was previously attached to time out, we need to keep returning error
911+
// so as reconciler can not confirm this volume as attached.
912+
if nodeName == TimeoutAttachNode {
913+
return "", fmt.Errorf("Timed out to attach volume %q to node %q", volumeName, nodeName)
914+
}
910915
if volumeNode == nodeName || volumeNode == MultiAttachNode || nodeName == MultiAttachNode {
911916
return "/dev/vdb-test", nil
912917
}

0 commit comments

Comments
 (0)