consumer_metadata_request_test.go 627 B

1234567891011121314151617181920212223
  1. package sarama
  2. import (
  3. "testing"
  4. )
  5. var (
  6. consumerMetadataRequestEmpty = []byte{
  7. 0x00, 0x00}
  8. consumerMetadataRequestString = []byte{
  9. 0x00, 0x06, 'f', 'o', 'o', 'b', 'a', 'r'}
  10. )
  11. func TestConsumerMetadataRequest(t *testing.T) {
  12. request := new(ConsumerMetadataRequest)
  13. testEncodable(t, "empty string", request, consumerMetadataRequestEmpty)
  14. testVersionDecodable(t, "empty string", request, consumerMetadataRequestEmpty, 0)
  15. request.ConsumerGroup = "foobar"
  16. testEncodable(t, "with string", request, consumerMetadataRequestString)
  17. testVersionDecodable(t, "with string", request, consumerMetadataRequestString, 0)
  18. }