(t *testing.T)
| 325 | } |
| 326 | |
| 327 | func TestRetryTopic(t *testing.T) { |
| 328 | // Test that Send is retried if the driver returns a retryable error. |
| 329 | ctx := context.Background() |
| 330 | ft := &failTopic{} |
| 331 | topic := NewTopic(ft, nil) |
| 332 | defer topic.Shutdown(ctx) |
| 333 | err := topic.Send(ctx, &Message{}) |
| 334 | if err != nil { |
| 335 | t.Errorf("Send: got %v, want nil", err) |
| 336 | } |
| 337 | if got, want := ft.calls, nRetryCalls+1; got != want { |
| 338 | t.Errorf("calls: got %d, want %d", got, want) |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | var errRetry = errors.New("retry") |
| 343 |