Skip to content

Commit

Permalink
Merge pull request #2287 from demergent-labs/fuzz_workflow
Browse files Browse the repository at this point in the history
add a custom fuzz testing workflow
  • Loading branch information
lastmjs authored Nov 25, 2024
2 parents 3e6db77 + ea3a125 commit de93f01
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Fuzz

on:
workflow_dispatch:
inputs:
call-delay:
description: 'Length of time (in seconds) to wait between canister method fuzz test calls'
required: false
type: number
default: .1
timeout:
description: 'Length of time (in minutes) after which the fuzz tests will automatically succeed'
required: false
type: number
default: '300'

jobs:
run-tests:
name: ${{ matrix.test_group.name }}
strategy:
fail-fast: false
matrix:
test_group:
- {
name: 'E2E Class',
directories: './tests/end_to_end/candid_rpc/class_syntax'
}
- {
name: 'Property IC API',
directories: './tests/property/ic_api'
}
uses: ./.github/workflows/get_and_run_tests.yml
with:
directories: ${{ matrix.test_group.directories }}
fuzz: true
19 changes: 18 additions & 1 deletion .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ on:
required: false
type: boolean
default: false
call-delay:
required: false
type: number
default: .1
timeout:
required: false
type: number
default: 300

jobs:
run-test:
Expand Down Expand Up @@ -138,11 +146,20 @@ jobs:
shell: bash -l {0}

- name: Run tests
run: npm test
run: |
timeout ${{ inputs.timeout }}m npm test
exit_code=$?
if [ $exit_code -eq 124 ] || [ $exit_code -eq 142 ]; then
# Exit code 124 is for timeout, 142 is for SIGALRM
exit 0
else
exit $exit_code
fi
shell: bash -l {0}
working-directory: ${{ matrix.test.path }}
env:
AZLE_PROPTEST_NUM_RUNS: ${{ steps.calc-runs.outputs.runs }}
AZLE_PROPTEST_VERBOSE: true
AZLE_EXPERIMENTAL: ${{ inputs.run_experimental }}
AZLE_FUZZ: ${{ inputs.fuzz }}
AZLE_FUZZ_CALL_DELAY: ${{ inputs.call-delay }}

0 comments on commit de93f01

Please sign in to comment.