| 53 | } |
| 54 | |
| 55 | func TestReceiveWithEmptyBatchReturnedFromDriver(t *testing.T) { |
| 56 | ctx := context.Background() |
| 57 | ds := &scriptedSub{ |
| 58 | batches: [][]*driver.Message{ |
| 59 | // First call gets an empty batch. |
| 60 | {}, |
| 61 | // Second call gets a non-empty batch. |
| 62 | {&driver.Message{}}, |
| 63 | }, |
| 64 | } |
| 65 | sub := pubsub.NewSubscription(ds, nil, nil) |
| 66 | defer sub.Shutdown(ctx) |
| 67 | m, err := sub.Receive(ctx) |
| 68 | if err != nil { |
| 69 | t.Fatal(err) |
| 70 | } |
| 71 | m.Ack() |
| 72 | } |
| 73 | |
| 74 | func TestSubscriptionCloseIsCalled(t *testing.T) { |
| 75 | ctx := context.Background() |