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

Function TestMetadataResponseWithBrokersV0

metadata_response_test.go:192–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

190}
191
192func TestMetadataResponseWithBrokersV0(t *testing.T) {
193 response := MetadataResponse{}
194
195 testVersionDecodable(t, "brokers, no topics, V0", &response, brokersNoTopicsMetadataResponseV0, 0)
196 if len(response.Brokers) != 2 {
197 t.Fatal("Decoding produced", len(response.Brokers), "brokers where there were two!")
198 }
199
200 if response.Brokers[0].id != 0xabff {
201 t.Error("Decoding produced invalid broker 0 id.")
202 }
203 if response.Brokers[0].addr != "localhost:51" {
204 t.Error("Decoding produced invalid broker 0 address.")
205 }
206 if response.Brokers[1].id != 0x010203 {
207 t.Error("Decoding produced invalid broker 1 id.")
208 }
209 if response.Brokers[1].addr != "google.com:273" {
210 t.Error("Decoding produced invalid broker 1 address.")
211 }
212
213 if len(response.Topics) != 0 {
214 t.Error("Decoding produced", len(response.Topics), "topics where there were none!")
215 }
216}
217
218func TestMetadataResponseWithTopicsV0(t *testing.T) {
219 response := MetadataResponse{}

Callers

nothing calls this directly

Calls 3

testVersionDecodableFunction · 0.85
FatalMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected