describe_log_dirs_request_test.go 863 B

12345678910111213141516171819202122232425262728293031
  1. package sarama
  2. import "testing"
  3. var (
  4. emptyDescribeLogDirsRequest = []byte{255, 255, 255, 255} // Empty array (array length -1 sent)
  5. topicDescribeLogDirsRequest = []byte{
  6. 0, 0, 0, 1, // DescribeTopics array, Array length 1
  7. 0, 6, // Topic name length 6
  8. 'r', 'a', 'n', 'd', 'o', 'm', // Topic name
  9. 0, 0, 0, 2, // PartitionIDs int32 array, Array length 2
  10. 0, 0, 0, 25, // PartitionID 25
  11. 0, 0, 0, 26, // PartitionID 26
  12. }
  13. )
  14. func TestDescribeLogDirsRequest(t *testing.T) {
  15. request := &DescribeLogDirsRequest{
  16. Version: 0,
  17. DescribeTopics: []DescribeLogDirsRequestTopic{},
  18. }
  19. testRequest(t, "no topics", request, emptyDescribeLogDirsRequest)
  20. request.DescribeTopics = []DescribeLogDirsRequestTopic{
  21. {
  22. Topic: "random",
  23. PartitionIDs: []int32{25, 26},
  24. },
  25. }
  26. testRequest(t, "no topics", request, topicDescribeLogDirsRequest)
  27. }