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

Function TestProtocol

protocol_test.go:34–160  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestProtocol(t *testing.T) {
35 tests := []interface{}{
36 int8(42),
37 int16(42),
38 int32(42),
39 int64(42),
40 "",
41 "Hello World!",
42 []byte(nil),
43 []byte("Hello World!"),
44
45 requestHeader{
46 Size: 26,
47 ApiKey: int16(offsetCommit),
48 ApiVersion: int16(v2),
49 CorrelationID: 42,
50 ClientID: "Hello World!",
51 },
52
53 message{
54 MagicByte: 1,
55 Timestamp: 42,
56 Key: nil,
57 Value: []byte("Hello World!"),
58 },
59
60 topicMetadataRequestV1{"A", "B", "C"},
61
62 metadataResponseV1{
63 Brokers: []brokerMetadataV1{
64 {NodeID: 1, Host: "localhost", Port: 9001},
65 {NodeID: 2, Host: "localhost", Port: 9002, Rack: "rack2"},
66 },
67 ControllerID: 2,
68 Topics: []topicMetadataV1{
69 {TopicErrorCode: 0, Internal: true, Partitions: []partitionMetadataV1{{
70 PartitionErrorCode: 0,
71 PartitionID: 1,
72 Leader: 2,
73 Replicas: []int32{1},
74 Isr: []int32{1},
75 }}},
76 },
77 },
78
79 topicMetadataRequestV6{
80 Topics: []string{"A", "B", "C"},
81 AllowAutoTopicCreation: true,
82 },
83
84 metadataResponseV6{
85 Brokers: []brokerMetadataV1{
86 {NodeID: 1, Host: "localhost", Port: 9001},
87 {NodeID: 2, Host: "localhost", Port: 9002, Rack: "rack2"},
88 },
89 ClusterId: "cluster",
90 ControllerID: 2,
91 Topics: []topicMetadataV6{

Callers

nothing calls this directly

Calls 6

writeMethod · 0.95
sizeofFunction · 0.85
readFunction · 0.85
NewReaderMethod · 0.65
LenMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected