-
Notifications
You must be signed in to change notification settings - Fork 844
test(reexecute): add firewood chaos test [2/2] #4695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
8971646
4ec0964
5c7ec5c
9a893da
4e1b5ac
7b6d057
c8e8582
506a2e3
004bc43
98273a0
d989910
fd0d1e0
00a4852
8b17166
8a239e6
c84015d
9b24d42
f1c7cf0
ef82e6a
c793199
439dd59
b472805
219b24a
59581a8
c29a101
ada0690
6464738
4740b85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "pull_request": { | ||
| "include": [ | ||
| { | ||
| "start-block": "101", | ||
| "end-block": "200000", | ||
| "block-dir-src": "cchain-mainnet-blocks-1m-ldb", | ||
| "current-state-dir-src": "cchain-current-state-firewood-100", | ||
| "min-wait-time": "120s", | ||
| "max-wait-time": "150s", | ||
| "runner": "ubuntu-latest", | ||
| "timeout-minutes": 60 | ||
| } | ||
| ] | ||
| }, | ||
| "schedule": { | ||
| "include": [ | ||
| { | ||
| "start-block": "101", | ||
| "end-block": "200000", | ||
| "block-dir-src": "cchain-mainnet-blocks-1m-ldb", | ||
| "current-state-dir-src": "cchain-current-state-firewood-100", | ||
| "min-wait-time": "120s", | ||
| "max-wait-time": "150s", | ||
| "runner": "ubuntu-latest", | ||
| "timeout-minutes": 60 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| name: Firewood Chaos Test | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| start-block: | ||
| description: 'The start block for the chaos test.' | ||
| default: '' | ||
| end-block: | ||
| description: 'The end block for the chaos test.' | ||
| default: '' | ||
| block-dir-src: | ||
| description: 'The source block directory. Supports S3 directory/zip and local directories.' | ||
| default: '' | ||
| current-state-dir-src: | ||
| description: 'The current state directory. Supports S3 directory/zip and local directories.' | ||
| default: '' | ||
| min-wait-time: | ||
| description: 'Minimum wait time before killing the process (e.g., 120s, 2m).' | ||
| default: '120s' | ||
| max-wait-time: | ||
| description: 'Maximum wait time before killing the process (e.g., 150s, 3m).' | ||
| default: '150s' | ||
| runner: | ||
| description: 'Runner to execute the chaos test. Input to the runs-on field of the job.' | ||
| required: true | ||
| timeout-minutes: | ||
| description: 'Timeout in minutes for the job.' | ||
| default: '60' | ||
| # XXX: remove this before merging | ||
| pull_request: | ||
| schedule: | ||
| - cron: '0 9 * * *' # Runs every day at 09:00 UTC (04:00 EST) | ||
|
|
||
| jobs: | ||
| define-matrix: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.define-matrix.outputs.matrix }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Define Matrix | ||
| id: define-matrix | ||
| shell: bash -x {0} | ||
| run: | | ||
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
| { | ||
| echo "matrix<<EOF" | ||
| printf '{ "include": [{ "start-block": "%s", "end-block": "%s", "block-dir-src": "%s", "current-state-dir-src": "%s", "min-wait-time": "%s", "max-wait-time": "%s", "runner": "%s", "timeout-minutes": %s }] }\n' \ | ||
| "${{ github.event.inputs.start-block }}" \ | ||
| "${{ github.event.inputs.end-block }}" \ | ||
| "${{ github.event.inputs.block-dir-src }}" \ | ||
| "${{ github.event.inputs.current-state-dir-src }}" \ | ||
| "${{ github.event.inputs.min-wait-time }}" \ | ||
| "${{ github.event.inputs.max-wait-time }}" \ | ||
| "${{ github.event.inputs.runner }}" \ | ||
| "${{ github.event.inputs.timeout-minutes }}" | ||
| echo EOF | ||
| } >> "$GITHUB_OUTPUT" | ||
| else | ||
| json_string=$(jq -r ".\"${{ github.event_name }}\"" .github/workflows/chaos-test.json) | ||
| { | ||
| echo "matrix<<EOF" | ||
| echo "$json_string" | ||
| echo EOF | ||
| } >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| firewood-chaos-test: | ||
| needs: define-matrix | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }} | ||
| timeout-minutes: ${{ matrix.timeout-minutes }} | ||
| runs-on: ${{ matrix.runner }} | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f #v31 | ||
| with: | ||
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_S3_READ_ONLY_ROLE }} | ||
| aws-region: 'us-east-2' | ||
| role-duration-seconds: '43200' | ||
| - uses: actions/checkout@v4 | ||
| - name: Set task env | ||
| shell: bash | ||
| run: | | ||
| TIMESTAMP=$(date '+%Y%m%d-%H%M%S') | ||
| echo "EXECUTION_DATA_DIR=/tmp/reexecution-data-${TIMESTAMP}" >> "$GITHUB_ENV" | ||
| - name: Run chaos test with Firewood | ||
| shell: nix develop --impure --command bash -x {0} | ||
| run: | | ||
| TIMESTAMP=$(date +%s) | ||
| EXECUTION_DATA_DIR="/tmp/reexecution-data-${TIMESTAMP}" | ||
| ./scripts/run_task.sh firewood-chaos-test-with-copied-data \ | ||
| START_BLOCK=${{ matrix.start-block }} \ | ||
| END_BLOCK=${{ matrix.end-block }} \ | ||
| BLOCK_DIR_SRC=${{ matrix.block-dir-src }} \ | ||
| EXECUTION_DATA_DIR=$EXECUTION_DATA_DIR \ | ||
| CURRENT_STATE_DIR_SRC=${{ matrix.current-state-dir-src }} \ | ||
| MIN_WAIT_TIME=${{ matrix.min-wait-time }} \ | ||
| MAX_WAIT_TIME=${{ matrix.max-wait-time }} | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,6 +117,45 @@ tasks: | |
| cmds: | ||
| - cmd: bash -x ./scripts/copy_dir.sh {{.SRC}} {{.DST}} | ||
|
|
||
| firewood-chaos-test: | ||
|
||
| desc: Chaos test during reexecution test with Firewood | ||
| vars: | ||
| START_BLOCK: '{{.START_BLOCK}}' | ||
| END_BLOCK: '{{.END_BLOCK}}' | ||
| CURRENT_STATE_DIR: '{{.CURRENT_STATE_DIR}}' | ||
| BLOCK_DIR: '{{.BLOCK_DIR}}' | ||
| MIN_WAIT_TIME: '{{.MIN_WAIT_TIME}}' | ||
| MAX_WAIT_TIME: '{{.MAX_WAIT_TIME}}' | ||
| cmd: go run ./tests/reexecute/chaos --start-block={{.START_BLOCK}} | ||
| --end-block={{.END_BLOCK}} --current-state-dir={{.CURRENT_STATE_DIR}} | ||
| --block-dir={{.BLOCK_DIR}} --min-wait-time={{.MIN_WAIT_TIME}} | ||
| --max-wait-time={{.MAX_WAIT_TIME}} | ||
|
|
||
| firewood-chaos-test-with-copied-data: | ||
| desc: Combines import-cchain-reexecute-range and firewood-chaos-test | ||
| vars: | ||
| START_BLOCK: '{{.START_BLOCK}}' | ||
| END_BLOCK: '{{.END_BLOCK}}' | ||
| CURRENT_STATE_DIR_SRC: '{{.CURRENT_STATE_DIR_SRC}}' | ||
| BLOCK_DIR_SRC: '{{.BLOCK_DIR_SRC}}' | ||
| EXECUTION_DATA_DIR: '{{.EXECUTION_DATA_DIR}}' | ||
| MIN_WAIT_TIME: '{{.MIN_WAIT_TIME}}' | ||
| MAX_WAIT_TIME: '{{.MAX_WAIT_TIME}}' | ||
| cmds: | ||
| - task: import-cchain-reexecute-range | ||
| vars: | ||
| BLOCK_DIR_SRC: '{{.S3_BOOTSTRAP_BUCKET}}/{{.BLOCK_DIR_SRC}}/**' | ||
| CURRENT_STATE_DIR_SRC: '{{.S3_BOOTSTRAP_BUCKET}}/{{.CURRENT_STATE_DIR_SRC}}/**' | ||
| EXECUTION_DATA_DIR: '{{.EXECUTION_DATA_DIR}}' | ||
| - task: firewood-chaos-test | ||
| vars: | ||
| START_BLOCK: '{{.START_BLOCK}}' | ||
| END_BLOCK: '{{.END_BLOCK}}' | ||
| CURRENT_STATE_DIR: '{{.EXECUTION_DATA_DIR}}/current-state' | ||
| BLOCK_DIR: '{{.EXECUTION_DATA_DIR}}/blocks' | ||
| MIN_WAIT_TIME: '{{.MIN_WAIT_TIME}}' | ||
| MAX_WAIT_TIME: '{{.MAX_WAIT_TIME}}' | ||
|
|
||
| generate-mocks: | ||
| desc: Generates testing mocks | ||
| cmds: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also as per the example of #4761, please ensure that configuration required to run a test locally is defined outside of github actions - ideally execution would be something like
task run-test test-name. That could mean that onlytest,runnerandtimeout-minuteswould be defined in this file, and given that both the runner and the timeout are static, the value of this file would seem questionable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also went ahead and removed the JSON file as suggested: 9b24d42