offset_commit_response_test.go 606 B

123456789101112131415161718192021222324
  1. package sarama
  2. import (
  3. "testing"
  4. )
  5. var (
  6. emptyOffsetCommitResponse = []byte{
  7. 0x00, 0x00, 0x00, 0x00}
  8. )
  9. func TestEmptyOffsetCommitResponse(t *testing.T) {
  10. response := OffsetCommitResponse{}
  11. testResponse(t, "empty", &response, emptyOffsetCommitResponse)
  12. }
  13. func TestNormalOffsetCommitResponse(t *testing.T) {
  14. response := OffsetCommitResponse{}
  15. response.AddError("t", 0, ErrNotLeaderForPartition)
  16. response.Errors["m"] = make(map[int32]KError)
  17. // The response encoded form cannot be checked for it varies due to
  18. // unpredictable map traversal order.
  19. testResponse(t, "normal", &response, nil)
  20. }