func waitForAttach( t *testing.T, fakePlugin *volumetesting.FakeVolumePlugin, asw cache.ActualStateOfWorld) { err := retryWithExponentialBackOff( time.Duration(5*time.Millisecond), func() (bool, error) { mountedVolumes := asw.GetMountedVolumes() if len(mountedVolumes) > 0 { return true, nil } return false, nil }, ) if err != nil { t.Fatalf("Timed out waiting for len of asw.GetMountedVolumes() to become non-zero.") } }
func waitForMount( t *testing.T, fakePlugin *volumetesting.FakeVolumePlugin, volumeName api.UniqueVolumeName, asw cache.ActualStateOfWorld) { err := retryWithExponentialBackOff( time.Duration(5*time.Millisecond), func() (bool, error) { mountedVolumes := asw.GetMountedVolumes() for _, mountedVolume := range mountedVolumes { if mountedVolume.VolumeName == volumeName { return true, nil } } return false, nil }, ) if err != nil { t.Fatalf("Timed out waiting for volume %q to be attached.", volumeName) } }