txn_offset_commit_request_test.go 769 B

1234567891011121314151617181920212223242526272829303132333435
  1. package sarama
  2. import "testing"
  3. var (
  4. txnOffsetCommitRequest = []byte{
  5. 0, 3, 't', 'x', 'n',
  6. 0, 7, 'g', 'r', 'o', 'u', 'p', 'i', 'd',
  7. 0, 0, 0, 0, 0, 0, 31, 64, // producer ID
  8. 0, 1, // producer epoch
  9. 0, 0, 0, 1, // 1 topic
  10. 0, 5, 't', 'o', 'p', 'i', 'c',
  11. 0, 0, 0, 1, // 1 partition
  12. 0, 0, 0, 2, // partition no 2
  13. 0, 0, 0, 0, 0, 0, 0, 123,
  14. 255, 255, // no meta data
  15. }
  16. )
  17. func TestTxnOffsetCommitRequest(t *testing.T) {
  18. req := &TxnOffsetCommitRequest{
  19. TransactionalID: "txn",
  20. GroupID: "groupid",
  21. ProducerID: 8000,
  22. ProducerEpoch: 1,
  23. Topics: map[string][]*PartitionOffsetMetadata{
  24. "topic": []*PartitionOffsetMetadata{{
  25. Offset: 123,
  26. Partition: 2,
  27. }},
  28. },
  29. }
  30. testRequest(t, "", req, txnOffsetCommitRequest)
  31. }