From ea3a125927fa6f70456eb62a63bd1bff75af9c0a Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Mon, 25 Nov 2024 14:39:24 -0700 Subject: [PATCH] add a custom fuzz testing workflow --- .github/workflows/fuzz.yml | 35 ++++++++++++++++++++++++++++++++++ .github/workflows/run_test.yml | 19 +++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/fuzz.yml diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml new file mode 100644 index 0000000000..811af6c272 --- /dev/null +++ b/.github/workflows/fuzz.yml @@ -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 diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index 79b57998e9..05c2bd7776 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -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: @@ -138,7 +146,15 @@ 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: @@ -146,3 +162,4 @@ jobs: AZLE_PROPTEST_VERBOSE: true AZLE_EXPERIMENTAL: ${{ inputs.run_experimental }} AZLE_FUZZ: ${{ inputs.fuzz }} + AZLE_FUZZ_CALL_DELAY: ${{ inputs.call-delay }}