list_partition_reassignments_request_test.go 775 B

12345678910111213141516171819202122232425262728293031
  1. package sarama
  2. import "testing"
  3. var (
  4. listPartitionReassignmentsRequestOneBlock = []byte{
  5. 0, 0, 39, 16, // timeout 10000
  6. 2, // 2-1=1 block
  7. 6, 116, 111, 112, 105, 99, // topic name "topic" as compact string
  8. 2, // 2-1=1 partitions
  9. 0, 0, 0, 0, // partitionId
  10. 0, 0, // empty tagged fields
  11. }
  12. )
  13. func TestListPartitionReassignmentRequest(t *testing.T) {
  14. var request *ListPartitionReassignmentsRequest
  15. request = &ListPartitionReassignmentsRequest{
  16. TimeoutMs: int32(10000),
  17. Version: int16(0),
  18. }
  19. request.AddBlock("topic", []int32{0})
  20. testRequest(t, "one block", request, listPartitionReassignmentsRequestOneBlock)
  21. request.AddBlock("topic2", []int32{1, 2})
  22. testRequestWithoutByteComparison(t, "two blocks", request)
  23. }