add_partitions_to_txn_request_test.go 536 B

123456789101112131415161718192021222324252627
  1. package sarama
  2. import "testing"
  3. var (
  4. addPartitionsToTxnRequest = []byte{
  5. 0, 3, 't', 'x', 'n',
  6. 0, 0, 0, 0, 0, 0, 31, 64, // ProducerID
  7. 0, 0, 0, 0, // ProducerEpoch
  8. 0, 1, // 1 topic
  9. 0, 5, 't', 'o', 'p', 'i', 'c',
  10. 0, 0, 0, 1, 0, 0, 0, 1,
  11. }
  12. )
  13. func TestAddPartitionsToTxnRequest(t *testing.T) {
  14. req := &AddPartitionsToTxnRequest{
  15. TransactionalID: "txn",
  16. ProducerID: 8000,
  17. ProducerEpoch: 0,
  18. TopicPartitions: map[string][]int32{
  19. "topic": {1},
  20. },
  21. }
  22. testRequest(t, "", req, addPartitionsToTxnRequest)
  23. }