From 4ad9d6e781c77e3b6f9f603717db56bcc5526055 Mon Sep 17 00:00:00 2001 From: chrislu Date: Fri, 12 Sep 2025 12:52:25 -0700 Subject: [PATCH] ci: add Kafka and PostgreSQL gateway tests to GitHub Actions - Added comprehensive Kafka Gateway test workflow: * Unit tests for protocol handlers * Client compatibility tests (kafka-go, Sarama) * Protocol version tests (Metadata, Produce, ApiVersions) - Added PostgreSQL Gateway test workflow: * Basic connectivity tests * Client integration tests * Docker-based test environment Both workflows include proper caching, logging, and cleanup procedures. --- .github/workflows/kafka-tests.yml | 102 +++++++++++++++++++++++++++ .github/workflows/postgres-tests.yml | 73 +++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 .github/workflows/kafka-tests.yml create mode 100644 .github/workflows/postgres-tests.yml diff --git a/.github/workflows/kafka-tests.yml b/.github/workflows/kafka-tests.yml new file mode 100644 index 000000000..0df36dc5f --- /dev/null +++ b/.github/workflows/kafka-tests.yml @@ -0,0 +1,102 @@ +name: "Kafka Gateway Tests" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +concurrency: + group: ${{ github.head_ref }}/kafka-tests + cancel-in-progress: true + +permissions: + contents: read + +jobs: + kafka-unit-tests: + name: Kafka Unit Tests + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v5 + with: + go-version: ^1.21 + id: go + + - name: Check out code + uses: actions/checkout@v4 + + - name: Get dependencies + run: | + cd test/kafka + go mod download + + - name: Run Kafka Gateway Unit Tests + run: | + cd test/kafka + go test -v -timeout 30s ./... + + kafka-client-compatibility: + name: Kafka Client Compatibility + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v5 + with: + go-version: ^1.21 + id: go + + - name: Check out code + uses: actions/checkout@v4 + + - name: Get dependencies + run: | + cd test/kafka + go mod download + + - name: Test kafka-go Client Compatibility + run: | + cd test/kafka + go test -v -run TestKafkaGo_ProduceOnly -timeout 10s + + - name: Test Sarama Client Compatibility + run: | + cd test/kafka + go test -v -run TestSarama -timeout 10s + + kafka-protocol-tests: + name: Kafka Protocol Tests + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v5 + with: + go-version: ^1.21 + id: go + + - name: Check out code + uses: actions/checkout@v4 + + - name: Get dependencies + run: | + cd test/kafka + go mod download + + - name: Test Metadata API Versions + run: | + cd test/kafka + go test -v -run TestMetadata -timeout 10s + + - name: Test Produce API Versions + run: | + cd test/kafka + go test -v -run TestProduce -timeout 10s + + - name: Test ApiVersions Compatibility + run: | + cd test/kafka + go test -v -run TestApiVersions -timeout 10s diff --git a/.github/workflows/postgres-tests.yml b/.github/workflows/postgres-tests.yml new file mode 100644 index 000000000..23cfc043e --- /dev/null +++ b/.github/workflows/postgres-tests.yml @@ -0,0 +1,73 @@ +name: "PostgreSQL Gateway Tests" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +concurrency: + group: ${{ github.head_ref }}/postgres-tests + cancel-in-progress: true + +permissions: + contents: read + +jobs: + postgres-basic-tests: + name: PostgreSQL Basic Tests + runs-on: ubuntu-latest + timeout-minutes: 15 + defaults: + run: + working-directory: test/postgres + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v5 + with: + go-version: ^1.21 + id: go + + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-postgres-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-postgres- + + - name: Start PostgreSQL Gateway Services + run: | + make start-seaweedfs + sleep 10 + + - name: Run Basic Connectivity Test + run: | + make test-basic + + - name: Run PostgreSQL Client Tests + run: | + make test-client + + - name: Save logs + if: always() + run: | + docker compose logs > postgres-output.log || true + + - name: Archive logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: postgres-logs + path: test/postgres/postgres-output.log + + - name: Cleanup + if: always() + run: | + make clean || true