Chaos Testing #15
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: Chaos Testing | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| consensus-client-changed: | |
| required: true | |
| type: string | |
| default: 'true' | |
| description: 'when false, skips the job' | |
| enable_ssh_debug: | |
| description: 'Enable SSH debugging before tests start' | |
| required: false | |
| type: boolean | |
| default: false | |
| ssh_debug_on_failure: | |
| required: false | |
| type: boolean | |
| default: false | |
| description: 'Enable SSH debugging on test failure' | |
| workflow_call: | |
| inputs: | |
| consensus-client-changed: | |
| required: true | |
| type: string | |
| enable_ssh_debug: | |
| required: false | |
| type: boolean | |
| default: false | |
| ssh_debug_on_failure: | |
| required: false | |
| type: boolean | |
| default: false | |
| secrets: | |
| DOCKERHUB_USERNAME: | |
| required: false | |
| DOCKERHUB_TOKEN: | |
| required: false | |
| concurrency: | |
| group: maru-chaos-testing-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| run-chaos-tests: | |
| if: ${{ inputs.consensus-client-changed == 'true' }} | |
| env: | |
| COMMIT_TAG: ${{ inputs.commit_tag }} | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| runs-on: [ gha-runner-scale-set-ubuntu-22.04-amd64-large ] | |
| name: chaos tests | |
| # useful for debugging flaky tests. | |
| # strategy: | |
| # matrix: | |
| # iterations: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to Docker Hub | |
| if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }} | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # 4.4.0 | |
| - name: Install helm | |
| uses: azure/[email protected] | |
| with: | |
| version: 'v3.18.3' | |
| id: install | |
| # SSH debugging session - before tests (if explicitly requested) | |
| - name: Setup upterm session (pre-test) | |
| if: ${{ inputs.enable_ssh_debug }} | |
| uses: lhotari/action-upterm@v1 | |
| with: | |
| ## If no one connects shut down ssh server after timeout. | |
| wait-timeout-minutes: 20 | |
| - name: Run chaos tests | |
| id: chaos-tests | |
| timeout-minutes: 30 | |
| run: | | |
| cd chaos-testing | |
| mkdir -p ~/.kube | |
| export KUBECONFIG=~/.kube/k3s-server | |
| make k3s-reload # installs k3s K8S implementation | |
| kubectl config set-context --current --namespace=default | |
| make chaos-redeploy-chaos-mesh-and-linea maru_image=consensys/maru:local | |
| make chaos-health-check # just make sure that the cluster is healthy before starting the chaos tests | |
| make chaos-experiment-workflow-and-health-check | |
| # SSH debugging session - on failure (if requested) | |
| - name: Setup upterm session after failure | |
| if: ${{ (failure() || steps.chaos-tests.outcome == 'failure') && inputs.ssh_debug_on_failure == true }} | |
| uses: lhotari/action-upterm@v1 | |
| with: | |
| ## If no one connects shut down ssh server after timeout. | |
| wait-timeout-minutes: 20 | |
| - name: Store reports | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test reports | |
| path: | | |
| **/build/reports/tests/ |