We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WithSleepFunc is a great way to test retries without waiting for them, and allows assertions against the requested sleep time 👌🏼
WithSleepFunc
However, threading this through from tests to the retryer can be tricky. I'd love to be able to set it globally for the duration of a test like this:
func TestRetryingThings(t *testing.T) { oldSleepFunc := roko.GlobalSleepFunc roko.GlobalSleepFunc = func(t time.Duration) {} defer func() { roko.GlobalSleepFunc = nil }() result := doThingsThatIndirectlyRetry() // assert things }
Or maybe it can be designed to be defer-friendly nested/reentrant-ish:
defer
func TestRetryingThings(t *testing.T) { revert := roko.WithGlobalSleepFunc(func (t time.Duration) {}) defer revert() // restore whatever the previous global sleep func was result := doThingsThatIndirectlyRetry() // assert things }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
WithSleepFunc
is a great way to test retries without waiting for them, and allows assertions against the requested sleep time 👌🏼However, threading this through from tests to the retryer can be tricky.
I'd love to be able to set it globally for the duration of a test like this:
Or maybe it can be designed to be
defer
-friendly nested/reentrant-ish:The text was updated successfully, but these errors were encountered: