txn_offset_commit_response_test.go 565 B

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