Add functional test CI: Docker MySQL topology + ProxySQL + failover tests #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Functional Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| functional: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25.7' | |
| cache: true | |
| - name: Build orchestrator (for CLI tests on host) | |
| run: go build -o bin/orchestrator ./go/cmd/orchestrator | |
| - name: Start test infrastructure (MySQL + ProxySQL + Orchestrator) | |
| working-directory: tests/functional | |
| run: | | |
| docker compose up -d mysql1 mysql2 mysql3 proxysql | |
| echo "Waiting for MySQL and ProxySQL to be healthy..." | |
| timeout 120 bash -c ' | |
| while true; do | |
| HEALTHY=$(docker compose ps --format json 2>/dev/null | python3 -c " | |
| import json, sys | |
| healthy = 0 | |
| for line in sys.stdin: | |
| svc = json.loads(line) | |
| if \"healthy\" in svc.get(\"Status\",\"\").lower(): | |
| healthy += 1 | |
| print(healthy) | |
| " 2>/dev/null || echo "0") | |
| if [ "$HEALTHY" -ge 4 ]; then | |
| echo "All 4 services healthy" | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| ' || { echo "Timeout"; docker compose ps; docker compose logs --tail=30; exit 1; } | |
| - name: Setup replication | |
| run: bash tests/functional/setup-replication.sh | |
| - name: Start orchestrator in Docker network | |
| working-directory: tests/functional | |
| run: | | |
| docker compose up -d orchestrator | |
| echo "Waiting for orchestrator to be ready..." | |
| timeout 120 bash -c ' | |
| while true; do | |
| if curl -sf http://localhost:3099/api/clusters > /dev/null 2>&1; then | |
| echo "Orchestrator ready" | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| ' || { echo "Orchestrator not ready"; docker compose logs orchestrator --tail=50; exit 1; } | |
| - name: Run smoke tests | |
| run: bash tests/functional/test-smoke.sh | |
| - name: Run regression tests | |
| run: bash tests/functional/test-regression.sh | |
| - name: Run failover tests | |
| run: bash tests/functional/test-failover.sh | |
| - name: Collect orchestrator logs | |
| if: always() | |
| working-directory: tests/functional | |
| run: docker compose logs orchestrator > /tmp/orchestrator-test.log 2>&1 || true | |
| - name: Upload orchestrator logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: orchestrator-test-logs | |
| path: /tmp/orchestrator-test.log | |
| - name: Collect all docker logs on failure | |
| if: failure() | |
| working-directory: tests/functional | |
| run: docker compose logs > /tmp/docker-compose-logs.txt 2>&1 || true | |
| - name: Upload docker logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-compose-logs | |
| path: /tmp/docker-compose-logs.txt | |
| - name: Cleanup | |
| if: always() | |
| working-directory: tests/functional | |
| run: docker compose down -v --remove-orphans 2>/dev/null || true |