Browse Source

fix tests

pull/7231/head
chrislu 2 months ago
parent
commit
4e11a378fd
  1. 22
      .github/workflows/kafka-tests.yml
  2. 2
      .github/workflows/postgres-tests.yml
  3. 2
      telemetry/server/Dockerfile
  4. 2
      test/fuse_integration/README.md
  5. 2
      test/kafka/Dockerfile.test-setup
  6. 7
      weed/mq/kafka/protocol/fetch_test.go
  7. 5
      weed/mq/kafka/protocol/offset_management.go

22
.github/workflows/kafka-tests.yml

@ -27,7 +27,7 @@ jobs:
matrix:
container-id: [unit-tests-1]
container:
image: golang:1.21-alpine
image: golang:1.24-alpine
options: --cpus 1.0 --memory 1g --hostname kafka-unit-${{ matrix.container-id }}
env:
GOMAXPROCS: 1
@ -37,7 +37,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: ^1.24
id: go
- name: Check out code
@ -59,7 +59,7 @@ jobs:
# Set process limits for container isolation
ulimit -n 512
ulimit -u 100
go test -v -timeout 10s -run "^Test" -skip "KafkaGateway_APISequence|KafkaGoClient_BasicProduceConsume|KafkaGoClient_ConsumerGroups|KafkaGoClient_OffsetManagement|Sarama" ./...
go test -v -timeout 10s -run "^Test" -skip "KafkaGateway_APISequence|KafkaGoClient_BasicProduceConsume|KafkaGoClient_ConsumerGroups|KafkaGoClient_OffsetManagement|TestOffsetManagement|Sarama" ./...
kafka-integration-tests:
name: Kafka Integration Tests (Critical)
@ -70,7 +70,7 @@ jobs:
matrix:
container-id: [integration-1]
container:
image: golang:1.21-alpine
image: golang:1.24-alpine
options: --cpus 2.0 --memory 2g --ulimit nofile=1024:1024 --hostname kafka-integration-${{ matrix.container-id }}
env:
GOMAXPROCS: 2
@ -81,7 +81,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: ^1.24
id: go
- name: Check out code
@ -129,7 +129,7 @@ jobs:
matrix:
container-id: [consumer-group-1]
container:
image: golang:1.21-alpine
image: golang:1.24-alpine
options: --cpus 1.0 --memory 2g --ulimit nofile=512:512 --hostname kafka-consumer-${{ matrix.container-id }}
env:
GOMAXPROCS: 1
@ -140,7 +140,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: ^1.24
id: go
- name: Check out code
@ -185,7 +185,7 @@ jobs:
matrix:
container-id: [client-compat-1]
container:
image: golang:1.21-alpine
image: golang:1.24-alpine
options: --cpus 1.0 --memory 1.5g --shm-size 256m --hostname kafka-client-${{ matrix.container-id }}
env:
GOMAXPROCS: 1
@ -196,7 +196,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: ^1.24
id: go
- name: Check out code
@ -236,7 +236,7 @@ jobs:
matrix:
container-id: [protocol-1]
container:
image: golang:1.21-alpine
image: golang:1.24-alpine
options: --cpus 1.0 --memory 1g --tmpfs /tmp --hostname kafka-protocol-${{ matrix.container-id }}
env:
GOMAXPROCS: 1
@ -247,7 +247,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: ^1.24
id: go
- name: Check out code

2
.github/workflows/postgres-tests.yml

@ -25,7 +25,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: ^1.24
id: go
- name: Check out code

2
telemetry/server/Dockerfile

@ -1,4 +1,4 @@
FROM golang:1.21-alpine AS builder
FROM golang:1.24-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./

2
test/fuse_integration/README.md

@ -232,7 +232,7 @@ jobs:
### Docker Testing
```dockerfile
FROM golang:1.21
FROM golang:1.24
RUN apt-get update && apt-get install -y fuse
COPY . /seaweedfs
WORKDIR /seaweedfs

2
test/kafka/Dockerfile.test-setup

@ -1,5 +1,5 @@
# Dockerfile for Kafka Integration Test Setup
FROM golang:1.21-alpine AS builder
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git make gcc musl-dev

7
weed/mq/kafka/protocol/fetch_test.go

@ -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)
}

5
weed/mq/kafka/protocol/offset_management.go

@ -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
}

Loading…
Cancel
Save