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
func TestMaxRetries(t *testing.T) { retryImmediately := retry.Backoff(0, 0, 0) type testArgs struct { retryPolicy retry.Policy fn func(*int) error } testCases := []struct { testName string args testArgs expected int }{ { testName: "function always fails", args: testArgs{ retryPolicy: retry.MaxTries(retryImmediately, 1), fn: func(callCount *int) error { *callCount++ return fmt.Errorf("always fail") }, }, expected: 1, }, } for _, tc := range testCases { t.Run(tc.testName, func(t *testing.T) { callCount := 0 retry.WaitForFn(context.Background(), tc.args.retryPolicy, tc.args.fn, &callCount) assert.Equal(t, tc.expected, callCount) }) } }
Result:
=== RUN TestMaxRetries === RUN TestMaxRetries/function_always_fails fn_test.go:127: Error Trace: fn_test.go:127 Error: Not equal: expected: 1 actual : 2 Test: TestMaxRetries/function_always_fails --- FAIL: TestMaxRetries (0.00s) --- FAIL: TestMaxRetries/function_always_fails (0.00s) Expected :1 Actual :2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Result:
The text was updated successfully, but these errors were encountered: