sixth version
This commit is contained in:
@@ -24,6 +24,16 @@ func TestWithRetryRetriesUntilSuccess(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequestWithTimeoutReturnsDeadline(t *testing.T) {
|
||||
_, err := requestWithTimeout(context.Background(), time.Millisecond, func() (int, error) {
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
return 1, nil
|
||||
})
|
||||
if !errors.Is(err, context.DeadlineExceeded) {
|
||||
t.Fatalf("err=%v, want DeadlineExceeded", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithRetryStopsOnContextCancel(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
Reference in New Issue
Block a user