offset_fetch_response_test.go 606 B

12345678910111213141516171819202122
  1. package sarama
  2. import "testing"
  3. var (
  4. emptyOffsetFetchResponse = []byte{
  5. 0x00, 0x00, 0x00, 0x00}
  6. )
  7. func TestEmptyOffsetFetchResponse(t *testing.T) {
  8. response := OffsetFetchResponse{}
  9. testResponse(t, "empty", &response, emptyOffsetFetchResponse)
  10. }
  11. func TestNormalOffsetFetchResponse(t *testing.T) {
  12. response := OffsetFetchResponse{}
  13. response.AddBlock("t", 0, &OffsetFetchResponseBlock{0, "md", ErrRequestTimedOut})
  14. response.Blocks["m"] = nil
  15. // The response encoded form cannot be checked for it varies due to
  16. // unpredictable map traversal order.
  17. testResponse(t, "normal", &response, nil)
  18. }