func waitForAttachCallCount( t *testing.T, expectedAttachCallCount int, fakePlugin *volumetesting.FakeVolumePlugin) { if len(fakePlugin.GetAttachers()) == 0 && expectedAttachCallCount == 0 { return } err := retryWithExponentialBackOff( time.Duration(5*time.Millisecond), func() (bool, error) { for i, attacher := range fakePlugin.GetAttachers() { actualCallCount := attacher.GetAttachCallCount() if actualCallCount == expectedAttachCallCount { return true, nil } t.Logf( "Warning: Wrong attacher[%v].GetAttachCallCount(). Expected: <%v> Actual: <%v>. Will try next attacher.", i, expectedAttachCallCount, actualCallCount) } t.Logf( "Warning: No attachers have expected AttachCallCount. Expected: <%v>. Will retry.", expectedAttachCallCount) return false, nil }, ) if err != nil { t.Fatalf( "No attachers have expected AttachCallCount. Expected: <%v>", expectedAttachCallCount) } }