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)
| 92 | // release that Sarama still needs to implement for parity, this is for dev |
| 93 | // tracking. |
| 94 | func 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, |
nothing calls this directly
no test coverage detected