MCPcopy
hub / github.com/IBM/sarama / TestAllocateBodyProtocolVersions

Function TestAllocateBodyProtocolVersions

request_test.go:94–570  ·  view source on GitHub ↗

TestAllocateBodyProtocolVersions tests two related version expectations: 1. uncommented entries are protocol versions Sarama currently supports with parity to a given Kafka release version 2. commented TODO entries are the max versions supported by the given Kafka release that Sarama still needs to

(t *testing.T)

Source from the content-addressed store, hash-verified

92// release that Sarama still needs to implement for parity, this is for dev
93// tracking.
94func TestAllocateBodyProtocolVersions(t *testing.T) {
95 type test struct {
96 version KafkaVersion
97 apiVersions map[int16]int16
98 }
99
100 saramaMaxVersions := newKafkaVersion(999, 999, 999, 999)
101 maxVersion := func(pb protocolBody) int16 {
102 var (
103 i int16
104 v int16
105 )
106 for i = 0; ; i++ {
107 pb.setVersion(i)
108 if !pb.isValidVersion() {
109 return v
110 }
111 v = i
112 }
113 }
114
115 tests := []test{
116 {
117 V1_1_0_0,
118 map[int16]int16{
119 apiKeyProduce: 5,
120 apiKeyFetch: 7,
121 apiKeyListOffsets: 2,
122 apiKeyMetadata: 5,
123 apiKeyLeaderAndIsr: 1,
124 apiKeyStopReplica: 0,
125 apiKeyUpdateMetadata: 4,
126 apiKeyControlledShutdown: 1,
127 apiKeyOffsetCommit: 3,
128 apiKeyOffsetFetch: 3,
129 apiKeyFindCoordinator: 1,
130 apiKeyJoinGroup: 2,
131 apiKeyHeartbeat: 1,
132 apiKeyLeaveGroup: 1,
133 apiKeySyncGroup: 1,
134 apiKeyDescribeGroups: 1,
135 apiKeyListGroups: 1,
136 apiKeySaslHandshake: 1,
137 apiKeyApiVersions: 1,
138 apiKeyCreateTopics: 2,
139 apiKeyDeleteTopics: 1,
140 apiKeyDeleteRecords: 0,
141 apiKeyInitProducerId: 0,
142 apiKeyOffsetForLeaderEpoch: 0,
143 apiKeyAddPartitionsToTxn: 0,
144 apiKeyAddOffsetsToTxn: 0,
145 apiKeyEndTxn: 0,
146 apiKeyWriteTxnMarkers: 0,
147 apiKeyTxnOffsetCommit: 0,
148 apiKeyDescribeAcls: 0,
149 apiKeyCreateAcls: 0,
150 apiKeyDeleteAcls: 0,
151 apiKeyDescribeConfigs: 1,

Callers

nothing calls this directly

Calls 11

newKafkaVersionFunction · 0.85
allocateBodyFunction · 0.85
allocateResponseBodyFunction · 0.85
RunMethod · 0.80
IsAtLeastMethod · 0.80
setVersionMethod · 0.65
isValidVersionMethod · 0.65
keyMethod · 0.65
versionMethod · 0.65
requiredVersionMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected