add_partitions_to_txn_response_test.go 585 B

12345678910111213141516171819202122232425262728293031
  1. package sarama
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. var (
  7. addPartitionsToTxnResponse = []byte{
  8. 0, 0, 0, 100,
  9. 0, 0, 0, 1,
  10. 0, 5, 't', 'o', 'p', 'i', 'c',
  11. 0, 0, 0, 1, // 1 partition error
  12. 0, 0, 0, 2, // partition 2
  13. 0, 48, // error
  14. }
  15. )
  16. func TestAddPartitionsToTxnResponse(t *testing.T) {
  17. resp := &AddPartitionsToTxnResponse{
  18. ThrottleTime: 100 * time.Millisecond,
  19. Errors: map[string][]*PartitionError{
  20. "topic": []*PartitionError{&PartitionError{
  21. Err: ErrInvalidTxnState,
  22. Partition: 2,
  23. }},
  24. },
  25. }
  26. testResponse(t, "", resp, addPartitionsToTxnResponse)
  27. }