Contract E2E Tests #119
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: Contract E2E Tests | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| timeout: | |
| description: 'Test timeout in minutes (default: 10)' | |
| required: false | |
| default: '10' | |
| type: string | |
| schedule: | |
| # Run contract E2E tests daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| permissions: | |
| contents: read | |
| actions: read | |
| env: | |
| GO_VERSION: '1.21' | |
| jobs: | |
| contract-e2e: | |
| name: Contract E2E Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 # Hard timeout slightly above test timeout | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install Kind | |
| run: | | |
| # Install Kind v0.20.0 for consistency | |
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64 | |
| chmod +x ./kind | |
| sudo mv ./kind /usr/local/bin/kind | |
| kind version | |
| - name: Install kubectl | |
| run: | | |
| # Install latest stable kubectl | |
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
| chmod +x kubectl | |
| sudo mv kubectl /usr/local/bin/kubectl | |
| kubectl version --client | |
| - name: Verify Docker is running | |
| run: | | |
| docker version | |
| docker info | |
| - name: Set test timeout | |
| id: timeout | |
| run: | | |
| TIMEOUT="${{ github.event.inputs.timeout || '10' }}" | |
| echo "timeout=${TIMEOUT}m" >> $GITHUB_OUTPUT | |
| echo "Test timeout set to: ${TIMEOUT} minutes" | |
| - name: Run contract E2E tests | |
| run: | | |
| echo "Running contract E2E tests..." | |
| echo "Environment: CI" | |
| echo "Timeout: ${{ steps.timeout.outputs.timeout }}" | |
| # Run contract tests with specified timeout | |
| make test-e2e-contract | |
| env: | |
| CI: true | |
| timeout-minutes: ${{ fromJSON(github.event.inputs.timeout || '10') }} | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: contract-e2e-test-results | |
| path: | | |
| test/e2e/contract/test-results.xml | |
| test/e2e/contract/coverage.out | |
| retention-days: 7 | |
| - name: Cleanup on failure | |
| if: failure() | |
| run: | | |
| echo "Contract E2E tests failed. Cleaning up..." | |
| make cleanup-contract-e2e || true | |
| - name: Report test status | |
| if: always() | |
| run: | | |
| if [ "${{ job.status }}" = "success" ]; then | |
| echo "✅ Contract E2E tests passed successfully" | |
| else | |
| echo "❌ Contract E2E tests failed" | |
| echo "This failure does NOT block releases - contract tests are for validation only" | |
| fi | |
| notify-results: | |
| name: Notify Test Results | |
| runs-on: ubuntu-latest | |
| needs: contract-e2e | |
| if: always() | |
| steps: | |
| - name: Report final status | |
| run: | | |
| if [ "${{ needs.contract-e2e.result }}" = "success" ]; then | |
| echo "✅ Contract E2E test suite completed successfully" | |
| echo "All user-visible behavior contracts are validated" | |
| else | |
| echo "❌ Contract E2E test suite failed" | |
| echo "Contract test failures indicate potential user-visible behavior issues" | |
| echo "These failures do NOT block releases but should be investigated" | |
| fi | |
| echo "Contract E2E tests validate:" | |
| echo "- Controller installation and readiness" | |
| echo "- Custom resource acceptance by API server" | |
| echo "- Status convergence to Ready=True condition" | |
| echo "- Test execution completes within 10 minutes" |