TestIndependentBatchReturn verifies that when multiple batch requests are sent, as long as one of them succeeds it should not block Subscription.Receive.
(t *testing.T)
| 304 | // TestIndependentBatchReturn verifies that when multiple batch requests are sent, |
| 305 | // as long as one of them succeeds it should not block Subscription.Receive. |
| 306 | func TestIndependentBatchReturn(t *testing.T) { |
| 307 | s := NewSubscription( |
| 308 | &secondReceiveBlockedDriverSub{}, |
| 309 | &batcher.Options{MaxBatchSize: 1, MaxHandlers: 2}, // force 2 batches by allowing 2 handlers and 1 msg per batch |
| 310 | nil, |
| 311 | ) |
| 312 | ctx := context.Background() |
| 313 | defer s.Shutdown(ctx) |
| 314 | |
| 315 | // Set the batch size to force 2 batches to be called. |
| 316 | s.runningBatchSize = 2 |
| 317 | ctxTimeout, cancel := context.WithTimeout(ctx, 10*time.Second) |
| 318 | defer cancel() |
| 319 | m, err := s.Receive(ctxTimeout) |
| 320 | if err != nil { |
| 321 | t.Fatal("Receive should not fail", err) |
| 322 | return |
| 323 | } |
| 324 | m.Ack() |
| 325 | } |
| 326 | |
| 327 | func TestRetryTopic(t *testing.T) { |
| 328 | // Test that Send is retried if the driver returns a retryable error. |
nothing calls this directly
no test coverage detected