acl_describe_response_test.go 937 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package sarama
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. var aclDescribeResponseError = []byte{
  7. 0, 0, 0, 100,
  8. 0, 8, // error
  9. 0, 5, 'e', 'r', 'r', 'o', 'r',
  10. 0, 0, 0, 1, // 1 resource
  11. 2, // cluster type
  12. 0, 5, 't', 'o', 'p', 'i', 'c',
  13. 0, 0, 0, 1, // 1 acl
  14. 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
  15. 0, 4, 'h', 'o', 's', 't',
  16. 4, // write
  17. 3, // allow
  18. }
  19. func TestAclDescribeResponse(t *testing.T) {
  20. errmsg := "error"
  21. resp := &DescribeAclsResponse{
  22. ThrottleTime: 100 * time.Millisecond,
  23. Err: ErrBrokerNotAvailable,
  24. ErrMsg: &errmsg,
  25. ResourceAcls: []*ResourceAcls{{
  26. Resource: Resource{
  27. ResourceName: "topic",
  28. ResourceType: AclResourceTopic,
  29. },
  30. Acls: []*Acl{
  31. {
  32. Principal: "principal",
  33. Host: "host",
  34. Operation: AclOperationWrite,
  35. PermissionType: AclPermissionAllow,
  36. },
  37. },
  38. }},
  39. }
  40. testResponse(t, "describe", resp, aclDescribeResponseError)
  41. }