(t *testing.T)
| 216 | } |
| 217 | |
| 218 | func TestMetadataResponseWithTopicsV0(t *testing.T) { |
| 219 | response := MetadataResponse{} |
| 220 | |
| 221 | testVersionDecodable(t, "topics, no brokers, V0", &response, topicsNoBrokersMetadataResponseV0, 0) |
| 222 | if len(response.Brokers) != 0 { |
| 223 | t.Error("Decoding produced", len(response.Brokers), "brokers where there were none!") |
| 224 | } |
| 225 | |
| 226 | if len(response.Topics) != 2 { |
| 227 | t.Fatal("Decoding produced", len(response.Topics), "topics where there were two!") |
| 228 | } |
| 229 | |
| 230 | if !errors.Is(response.Topics[0].Err, ErrNoError) { |
| 231 | t.Error("Decoding produced invalid topic 0 error.") |
| 232 | } |
| 233 | |
| 234 | if response.Topics[0].Name != "foo" { |
| 235 | t.Error("Decoding produced invalid topic 0 name.") |
| 236 | } |
| 237 | |
| 238 | if len(response.Topics[0].Partitions) != 1 { |
| 239 | t.Fatal("Decoding produced invalid partition count for topic 0.") |
| 240 | } |
| 241 | |
| 242 | if !errors.Is(response.Topics[0].Partitions[0].Err, ErrInvalidMessageSize) { |
| 243 | t.Error("Decoding produced invalid topic 0 partition 0 error.") |
| 244 | } |
| 245 | |
| 246 | if response.Topics[0].Partitions[0].ID != 0x01 { |
| 247 | t.Error("Decoding produced invalid topic 0 partition 0 id.") |
| 248 | } |
| 249 | |
| 250 | if response.Topics[0].Partitions[0].Leader != 0x07 { |
| 251 | t.Error("Decoding produced invalid topic 0 partition 0 leader.") |
| 252 | } |
| 253 | |
| 254 | if len(response.Topics[0].Partitions[0].Replicas) != 3 { |
| 255 | t.Fatal("Decoding produced invalid topic 0 partition 0 replicas.") |
| 256 | } |
| 257 | for i := range 3 { |
| 258 | if response.Topics[0].Partitions[0].Replicas[i] != int32(i+1) { |
| 259 | t.Error("Decoding produced invalid topic 0 partition 0 replica", i) |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | if len(response.Topics[0].Partitions[0].Isr) != 0 { |
| 264 | t.Error("Decoding produced invalid topic 0 partition 0 isr length.") |
| 265 | } |
| 266 | |
| 267 | if !errors.Is(response.Topics[1].Err, ErrNoError) { |
| 268 | t.Error("Decoding produced invalid topic 1 error.") |
| 269 | } |
| 270 | |
| 271 | if response.Topics[1].Name != "bar" { |
| 272 | t.Error("Decoding produced invalid topic 0 name.") |
| 273 | } |
| 274 | |
| 275 | if len(response.Topics[1].Partitions) != 0 { |
nothing calls this directly
no test coverage detected