MCPcopy
hub / github.com/segmentio/kafka-go / TestClientFetch

Function TestClientFetch

fetch_test.go:49–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestClientFetch(t *testing.T) {
50 client, topic, shutdown := newLocalClientAndTopic()
51 defer shutdown()
52
53 records := produceRecords(t, 10, client.Addr, topic, nil)
54
55 res, err := client.Fetch(context.Background(), &FetchRequest{
56 Topic: topic,
57 Partition: 0,
58 Offset: 0,
59 MinBytes: 1,
60 MaxBytes: 64 * 1024,
61 MaxWait: 100 * time.Millisecond,
62 })
63
64 if err != nil {
65 t.Fatal(err)
66 }
67
68 assertFetchResponse(t, res, &FetchResponse{
69 Topic: topic,
70 Partition: 0,
71 HighWatermark: 10,
72 Records: NewRecordReader(records...),
73 })
74}
75
76func TestClientFetchCompressed(t *testing.T) {
77 client, topic, shutdown := newLocalClientAndTopic()

Callers

nothing calls this directly

Calls 5

produceRecordsFunction · 0.85
assertFetchResponseFunction · 0.85
FetchMethod · 0.80
newLocalClientAndTopicFunction · 0.70
NewRecordReaderFunction · 0.70

Tested by

no test coverage detected