delete_topics_response_test.go 592 B

123456789101112131415161718192021222324252627282930313233343536
  1. package sarama
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. var (
  7. deleteTopicsResponseV0 = []byte{
  8. 0, 0, 0, 1,
  9. 0, 5, 't', 'o', 'p', 'i', 'c',
  10. 0, 0,
  11. }
  12. deleteTopicsResponseV1 = []byte{
  13. 0, 0, 0, 100,
  14. 0, 0, 0, 1,
  15. 0, 5, 't', 'o', 'p', 'i', 'c',
  16. 0, 0,
  17. }
  18. )
  19. func TestDeleteTopicsResponse(t *testing.T) {
  20. resp := &DeleteTopicsResponse{
  21. TopicErrorCodes: map[string]KError{
  22. "topic": ErrNoError,
  23. },
  24. }
  25. testResponse(t, "version 0", resp, deleteTopicsResponseV0)
  26. resp.Version = 1
  27. resp.ThrottleTime = 100 * time.Millisecond
  28. testResponse(t, "version 1", resp, deleteTopicsResponseV1)
  29. }