delete_records_request_test.go 614 B

123456789101112131415161718192021222324252627282930313233343536
  1. package sarama
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. var deleteRecordsRequest = []byte{
  7. 0, 0, 0, 2,
  8. 0, 5, 'o', 't', 'h', 'e', 'r',
  9. 0, 0, 0, 0,
  10. 0, 5, 't', 'o', 'p', 'i', 'c',
  11. 0, 0, 0, 2,
  12. 0, 0, 0, 19,
  13. 0, 0, 0, 0, 0, 0, 0, 200,
  14. 0, 0, 0, 20,
  15. 0, 0, 0, 0, 0, 0, 0, 190,
  16. 0, 0, 0, 100,
  17. }
  18. func TestDeleteRecordsRequest(t *testing.T) {
  19. req := &DeleteRecordsRequest{
  20. Topics: map[string]*DeleteRecordsRequestTopic{
  21. "topic": {
  22. PartitionOffsets: map[int32]int64{
  23. 19: 200,
  24. 20: 190,
  25. },
  26. },
  27. "other": {},
  28. },
  29. Timeout: 100 * time.Millisecond,
  30. }
  31. testRequest(t, "", req, deleteRecordsRequest)
  32. }