fix tests

This commit is contained in:
chrislu committed 2025-09-14 10:52:23 -07:00
1 parent 881a418b95
commit 4e11a378fd
7 files changed
+19 -23

No files matched your search

+4 -3
View File
@@ -1,6 +1,7 @@
package protocol
import (
"context"
"encoding/binary"
"testing"
"time"
@@ -67,7 +68,7 @@ func TestHandler_handleFetch(t *testing.T) {
requestBody = append(requestBody, 0, 0, 0, 0, 0, 0, 0, 0) // log start offset
requestBody = append(requestBody, 0, 0, 0x10, 0) // partition max bytes (1MB)
response, err := h.handleFetch(correlationID, 7, requestBody)
response, err := h.handleFetch(context.Background(), correlationID, 7, requestBody)
if err != nil {
t.Fatalf("handleFetch: %v", err)
}
@@ -196,7 +197,7 @@ func TestHandler_handleFetch_UnknownTopic(t *testing.T) {
requestBody = append(requestBody, 0, 0, 0, 0, 0, 0, 0, 0) // log start offset
requestBody = append(requestBody, 0, 0, 0x10, 0) // partition max bytes
response, err := h.handleFetch(correlationID, 7, requestBody)
response, err := h.handleFetch(context.Background(), correlationID, 7, requestBody)
if err != nil {
t.Fatalf("handleFetch: %v", err)
}
@@ -254,7 +255,7 @@ func TestHandler_handleFetch_EmptyPartition(t *testing.T) {
requestBody = append(requestBody, 0, 0, 0, 0, 0, 0, 0, 0) // log start offset
requestBody = append(requestBody, 0, 0, 0x10, 0) // partition max bytes
response, err := h.handleFetch(correlationID, 7, requestBody)
response, err := h.handleFetch(context.Background(), correlationID, 7, requestBody)
if err != nil {
t.Fatalf("handleFetch: %v", err)
}
@@ -647,11 +647,6 @@ func (h *Handler) buildOffsetFetchResponse(response OffsetFetchResponse, apiVers
binary.BigEndian.PutUint16(groupErrorBytes, uint16(response.ErrorCode))
result = append(result, groupErrorBytes...)
// Throttle time (4 bytes) - only included in version 3+
if apiVersion >= 3 {
result = append(result, 0, 0, 0, 0)
}
return result
}