MCPcopy Create free account
hub / github.com/google/go-cloud / TestReceiveWithEmptyBatchReturnedFromDriver

Function TestReceiveWithEmptyBatchReturnedFromDriver

pubsub/sub_test.go:55–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func 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
74func TestSubscriptionCloseIsCalled(t *testing.T) {
75 ctx := context.Background()

Callers

nothing calls this directly

Calls 3

ShutdownMethod · 0.95
ReceiveMethod · 0.95
AckMethod · 0.65

Tested by

no test coverage detected