func waitForNewAttacherCallCount( t *testing.T, expectedCallCount int, fakePlugin *volumetesting.FakeVolumePlugin) { err := retryWithExponentialBackOff( time.Duration(5*time.Millisecond), func() (bool, error) { actualCallCount := fakePlugin.GetNewAttacherCallCount() if actualCallCount >= expectedCallCount { return true, nil } t.Logf( "Warning: Wrong NewAttacherCallCount. Expected: <%v> Actual: <%v>. Will retry.", expectedCallCount, actualCallCount) return false, nil }, ) if err != nil { t.Fatalf( "Timed out waiting for NewAttacherCallCount. Expected: <%v> Actual: <%v>", expectedCallCount, fakePlugin.GetNewAttacherCallCount()) } }
func verifyNewAttacherCallCount( t *testing.T, expectZeroNewAttacherCallCount bool, fakePlugin *volumetesting.FakeVolumePlugin) { if expectZeroNewAttacherCallCount && fakePlugin.GetNewAttacherCallCount() != 0 { t.Fatalf( "Wrong NewAttacherCallCount. Expected: <0> Actual: <%v>", fakePlugin.GetNewAttacherCallCount()) } }