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

Function TestRecordReader

protocol/record_batch_test.go:37–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestRecordReader(t *testing.T) {
38 now := time.Now()
39
40 records := []memoryRecord{
41 {
42 offset: 1,
43 time: now,
44 key: []byte("key-1"),
45 },
46 {
47 offset: 2,
48 time: now.Add(time.Millisecond),
49 value: []byte("value-1"),
50 },
51 {
52 offset: 3,
53 time: now.Add(time.Second),
54 key: []byte("key-3"),
55 value: []byte("value-3"),
56 headers: []Header{
57 {Key: "answer", Value: []byte("42")},
58 },
59 },
60 }
61
62 r1 := NewRecordReader(makeRecords(records)...)
63 r2 := NewRecordReader(makeRecords(records)...)
64 assertRecords(t, r1, r2)
65}
66
67func TestMultiRecordReader(t *testing.T) {
68 now := time.Now()

Callers

nothing calls this directly

Calls 3

NewRecordReaderFunction · 0.70
makeRecordsFunction · 0.70
assertRecordsFunction · 0.70

Tested by

no test coverage detected