enhance: make log deletion complete and synchronous, add ClearMeta #314
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: Component Integration Test | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| - dev | |
| paths: | |
| - "**.go" | |
| - "go.mod" | |
| - "go.sum" | |
| - "config/**" | |
| - ".github/workflows/integration-test-components.yaml" | |
| - ".github/docker-compose-ci.yaml" | |
| workflow_call: | |
| concurrency: | |
| group: integration-test-components-${{ github.event_name == 'workflow_call' && 'nightly-' || '' }}${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| Component-Test: | |
| name: Component Integration Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Start dependencies (etcd + MinIO) | |
| run: | | |
| # Pull before `up` so a registry hiccup can be retried on its own: a Docker Hub | |
| # timeout used to fail the job before a single test ran (#256). Bounded — three | |
| # attempts with backoff, then give up. Never retry indefinitely. | |
| for attempt in 1 2 3; do | |
| if docker compose -f .github/docker-compose-ci.yaml pull; then break; fi | |
| if [ "$attempt" = 3 ]; then | |
| echo "::error::docker compose pull failed after 3 attempts" | |
| exit 1 | |
| fi | |
| echo "pull attempt $attempt failed; retrying in $((attempt * 10))s" | |
| sleep $((attempt * 10)) | |
| done | |
| docker compose -f .github/docker-compose-ci.yaml up -d | |
| # Bounded health waits too. An unbounded `until` loop here would burn the whole | |
| # job timeout and surface as a cancelled job rather than a clear error. | |
| for svc in ci-etcd ci-minio; do | |
| echo "Waiting for $svc..." | |
| for i in $(seq 60); do | |
| if [ "$(docker inspect --format='{{.State.Health.Status}}' "$svc" 2>/dev/null)" = healthy ]; then break; fi | |
| if [ "$i" = 60 ]; then | |
| echo "::error::$svc did not become healthy within 120s" | |
| docker logs "$svc" 2>&1 | tail -50 | |
| exit 1 | |
| fi | |
| sleep 2 | |
| done | |
| echo "$svc is ready" | |
| done | |
| - name: Create MinIO bucket | |
| run: | | |
| wget -q https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc | |
| chmod +x /usr/local/bin/mc | |
| mc alias set local http://localhost:9000 minioadmin minioadmin | |
| mc mb local/a-bucket --ignore-existing | |
| - name: Install gotestsum | |
| run: go install gotest.tools/gotestsum@latest | |
| - name: Run component integration tests | |
| run: | | |
| set +e | |
| gotestsum --format pkgname-and-test-fails \ | |
| --jsonfile test-output.json \ | |
| -- -race -cover -failfast -timeout=20m \ | |
| -skip "^(TestOpenWriter|TestOpenInternal|TestRepeated|TestWriterClose|TestClientRecreation|TestMultiClient|TestConcurrentWriteAnd|TestConcurrentReader|TestReadTheWritten|TestReadWriteLoop|TestMultiAppendSync|TestTailRead|TestConcurrentWriteWith|TestTruncate|TestWriteAndTruncate|TestMultiSegment|TestReadBefore|TestSegmentCleanup|TestStagedStorageService|TestServiceUpgrade|TestClientLogWriter)" \ | |
| ./tests/integration/... | |
| exit_code=$? | |
| echo "" | |
| echo "=== Test Results ===" | |
| jq -r 'select(.Test != null and .Elapsed != null) | select(.Action == "pass" or .Action == "fail") | (if .Action == "fail" then "FAIL" else "PASS" end) + " " + .Test + " (" + (.Elapsed | tostring) + "s)"' test-output.json | |
| exit $exit_code | |
| - name: Upload test output on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: integration-test-logs-components | |
| path: test-output.json | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| - name: Handle failure | |
| if: failure() && github.event_name == 'pull_request' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PR=${{ github.event.pull_request.number }} | |
| gh pr comment $PR --body "❌ **Component Integration Test** failed. Comment \`/rerun-component-test\` to rerun, or \`/rerun\` to rerun all failed checks." | |
| gh pr edit $PR --remove-label "ci-passed" 2>/dev/null || true | |
| - name: Add ci-passed label | |
| if: success() && github.event_name == 'pull_request' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PR=${{ github.event.pull_request.number }} | |
| SELF="${{ github.workflow }}" | |
| REQUIRED_CHECKS=("Lint" "Go Mod Tidy Check" "Unit Test" "E2E Local" "E2E Object Storage" "E2E Service" "Component Integration Test" "Chaos Test" "Operator Test" "Upgrade Compat Local" "Upgrade Compat Object Storage" "Upgrade Compat Service") | |
| CHECKS=$(gh pr checks $PR --json name,bucket 2>/dev/null || echo "[]") | |
| ALL_PASSED=true | |
| for check in "${REQUIRED_CHECKS[@]}"; do | |
| [ "$check" = "$SELF" ] && continue | |
| bucket=$(echo "$CHECKS" | jq -r --arg n "$check" '.[] | select(.name == $n) | .bucket' | head -1) | |
| # Skip checks not triggered for this PR (filtered out by `paths`); only block on checks that actually ran. | |
| [ -z "$bucket" ] && continue | |
| if [ "$bucket" != "pass" ]; then | |
| ALL_PASSED=false | |
| break | |
| fi | |
| done | |
| if [ "$ALL_PASSED" = true ]; then | |
| gh pr edit $PR --add-label "ci-passed" | |
| fi | |
| - name: Stop dependencies | |
| if: always() | |
| run: | | |
| docker compose -f .github/docker-compose-ci.yaml down -v |