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

Function TestRawProduceRequest

protocol/rawproduce/rawproduce_test.go:19–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestRawProduceRequest(t *testing.T) {
20 t0 := time.Now().Truncate(time.Millisecond)
21 t1 := t0.Add(1 * time.Millisecond)
22 t2 := t0.Add(2 * time.Millisecond)
23
24 prototest.TestRequestWithOverride(t, v0, &rawproduce.Request{
25 Acks: 1,
26 Timeout: 500,
27 Topics: []rawproduce.RequestTopic{
28 {
29 Topic: "topic-1",
30 Partitions: []rawproduce.RequestPartition{
31 {
32 Partition: 0,
33 RecordSet: NewRawRecordSet(protocol.NewRecordReader(
34 protocol.Record{Offset: 0, Time: t0, Key: nil, Value: nil},
35 ), 1, 0),
36 },
37 {
38 Partition: 1,
39 RecordSet: NewRawRecordSet(protocol.NewRecordReader(
40 protocol.Record{Offset: 0, Time: t0, Key: nil, Value: prototest.String("msg-0")},
41 protocol.Record{Offset: 1, Time: t1, Key: nil, Value: prototest.String("msg-1")},
42 protocol.Record{Offset: 2, Time: t2, Key: prototest.Bytes([]byte{1}), Value: prototest.String("msg-2")},
43 ), 1, 0),
44 },
45 },
46 },
47
48 {
49 Topic: "topic-2",
50 Partitions: []rawproduce.RequestPartition{
51 {
52 Partition: 0,
53 RecordSet: NewRawRecordSet(protocol.NewRecordReader(
54 protocol.Record{Offset: 0, Time: t0, Key: nil, Value: prototest.String("msg-0")},
55 protocol.Record{Offset: 1, Time: t1, Key: nil, Value: prototest.String("msg-1")},
56 protocol.Record{Offset: 2, Time: t2, Key: prototest.Bytes([]byte{1}), Value: prototest.String("msg-2")},
57 ), 1, protocol.Gzip),
58 },
59 },
60 },
61 },
62 })
63
64 prototest.TestRequestWithOverride(t, v3, &rawproduce.Request{
65 TransactionalID: "1234",
66 Acks: 1,
67 Timeout: 500,
68 Topics: []rawproduce.RequestTopic{
69 {
70 Topic: "topic-1",
71 Partitions: []rawproduce.RequestPartition{
72 {
73 Partition: 0,
74 RecordSet: NewRawRecordSet(protocol.NewRecordReader(
75 protocol.Record{Offset: 0, Time: t0, Key: nil, Value: nil},
76 ), 1, 0),

Callers

nothing calls this directly

Calls 6

TestRequestWithOverrideFunction · 0.92
NewRecordReaderFunction · 0.92
StringFunction · 0.92
BytesFunction · 0.92
NewRawRecordSetFunction · 0.70
TruncateMethod · 0.45

Tested by

no test coverage detected