From 4b0bb7bb60a92fe5154b177924b3e0323ff24c39 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 19 Dec 2024 17:45:23 -0700 Subject: [PATCH] updating cuzz with its own time limit --- .github/workflows/fuzz.yml | 4 ++-- .github/workflows/run_test.yml | 13 +++---------- .../candid_rpc/async_await/package-lock.json | 13 ++++++++++--- .../candid_rpc/stable_structures/cuzz.json | 1 + package-lock.json | 6 +++--- package.json | 2 +- test/fuzz.ts | 11 +++++++---- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 6f50b90711..e99b8d5bbe 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -8,7 +8,7 @@ on: required: false type: string default: '.1' - timeout: + time-limit: description: 'Length of time (in minutes) after which the fuzz tests will automatically succeed' required: false type: string @@ -41,5 +41,5 @@ jobs: stable/test/end_to_end/candid_rpc/tuple_types fuzz: true call-delay: ${{ inputs.call-delay }} - timeout: ${{ inputs.timeout }} + time-limit: ${{ inputs.time-limit }} link-azle: true diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index 74c7942fe9..67a99b9053 100644 --- a/.github/workflows/run_test.yml +++ b/.github/workflows/run_test.yml @@ -25,7 +25,7 @@ on: required: false type: string default: '.1' - timeout: + time-limit: required: false type: string default: '300' @@ -157,15 +157,7 @@ jobs: echo "runs=$RUNS" >> $GITHUB_OUTPUT - name: Run tests - 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 + run: npm test working-directory: ${{ matrix.test.path }} shell: bash -l {0} env: @@ -174,3 +166,4 @@ jobs: AZLE_EXPERIMENTAL: ${{ inputs.run-experimental }} AZLE_FUZZ: ${{ inputs.fuzz }} AZLE_FUZZ_CALL_DELAY: ${{ inputs.call-delay }} + AZLE_FUZZ_TIME_LIMIT: ${{ inputs.time-limit }} diff --git a/examples/stable/test/end_to_end/candid_rpc/async_await/package-lock.json b/examples/stable/test/end_to_end/candid_rpc/async_await/package-lock.json index 6090f7a611..6f601a4b4c 100644 --- a/examples/stable/test/end_to_end/candid_rpc/async_await/package-lock.json +++ b/examples/stable/test/end_to_end/candid_rpc/async_await/package-lock.json @@ -8,16 +8,23 @@ "azle": "0.24.1" }, "devDependencies": { - "async_await_end_to_end_test_functional_syntax": "file:../../functional_syntax/async_await" + "async_await_end_to_end_test_functional_syntax": "file:../../../../../experimental/test/end_to_end/candid_rpc/async_await" } }, - "../../functional_syntax/async_await": { + "../../../../../experimental/test/end_to_end/candid_rpc/async_await": { "name": "async_await_end_to_end_test_functional_syntax", "dev": true, "dependencies": { "azle": "0.24.1" } }, + "../../functional_syntax/async_await": { + "name": "async_await_end_to_end_test_functional_syntax", + "extraneous": true, + "dependencies": { + "azle": "0.24.1" + } + }, "node_modules/@adraffy/ens-normalize": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", @@ -568,7 +575,7 @@ } }, "node_modules/async_await_end_to_end_test_functional_syntax": { - "resolved": "../../functional_syntax/async_await", + "resolved": "../../../../../experimental/test/end_to_end/candid_rpc/async_await", "link": true }, "node_modules/azle": { diff --git a/examples/stable/test/end_to_end/candid_rpc/stable_structures/cuzz.json b/examples/stable/test/end_to_end/candid_rpc/stable_structures/cuzz.json index dcebdd1a60..04b4469c80 100644 --- a/examples/stable/test/end_to_end/candid_rpc/stable_structures/cuzz.json +++ b/examples/stable/test/end_to_end/candid_rpc/stable_structures/cuzz.json @@ -8,6 +8,7 @@ "Method: stableMap17Insert \\(update\\)[\\s\\S]*\"Request ID\":[\\s\\S]*\"Error code\":[\\s\\S]*\"Reject code\":[\\s\\S]*\"Reject message\":.*Uncaught SyntaxError: unexpected data at the end", "Method: stableMap17Remove \\(update\\)[\\s\\S]*\"Request ID\":[\\s\\S]*\"Error code\":[\\s\\S]*\"Reject code\":[\\s\\S]*\"Reject message\":.*Uncaught SyntaxError: unexpected token", "Method: stableMap17Remove \\(update\\)[\\s\\S]*\"Request ID\":[\\s\\S]*\"Error code\":[\\s\\S]*\"Reject code\":[\\s\\S]*\"Reject message\":.*Uncaught SyntaxError: Unexpected end of JSON input", + "Method: stableMap17Remove \\(update\\)[\\s\\S]*\"Request ID\":[\\s\\S]*\"Error code\":[\\s\\S]*\"Reject code\":[\\s\\S]*\"Reject message\":.*Uncaught SyntaxError: unexpected data at the end", "Method: stableMap17ContainsKey \\(query\\)[\\s\\S]*\"Status\":[\\s\\S]*\"Code\":[\\s\\S]*\"Message\":.*Uncaught SyntaxError: unexpected token", "Method: stableMap17ContainsKey \\(query\\)[\\s\\S]*\"Status\":[\\s\\S]*\"Code\":[\\s\\S]*\"Message\":.*Uncaught SyntaxError: unexpected data at the end", "Method: stableMap17ContainsKey \\(query\\)[\\s\\S]*\"Status\":[\\s\\S]*\"Code\":[\\s\\S]*\"Message\":.*Uncaught SyntaxError: Unexpected end of JSON input", diff --git a/package-lock.json b/package-lock.json index dd0982546f..3492b9ac84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "class-transformer": "^0.5.1", "class-validator": "^0.14.1", "crypto-browserify": "^3.12.0", - "cuzz": "github:demergent-labs/cuzz#8f07ef174570bbb142e84516c55ec598a09c625c", + "cuzz": "github:demergent-labs/cuzz#e9dcc6fc2f4d55ef880469cbe836b8730b530d07", "deep-is": "^0.1.4", "esbuild": "^0.24.0", "esbuild-plugin-tsc": "^0.4.0", @@ -3556,8 +3556,8 @@ }, "node_modules/cuzz": { "version": "0.0.0", - "resolved": "git+ssh://git@github.com/demergent-labs/cuzz.git#8f07ef174570bbb142e84516c55ec598a09c625c", - "integrity": "sha512-IcIEdboWoUdJdSU4pJcgj4DSBupLJW+vPlVtv2XylJOdOYHhDdhcDdaoUTL4A0nHn88cJvYLs5LW0rbjlKRLNA==", + "resolved": "git+ssh://git@github.com/demergent-labs/cuzz.git#e9dcc6fc2f4d55ef880469cbe836b8730b530d07", + "integrity": "sha512-4neyBS6k2RkUAg/CdMNqX94gBQf8mIFkB0f4/uY0MjaXVi3duiZksVVv1fbf+Z3DBvgOKZL05QwENxp+JHio/A==", "dependencies": { "@dfinity/agent": "^2.1.3", "@dfinity/candid": "^2.1.3", diff --git a/package.json b/package.json index 5c7e85377e..6540c663ad 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "class-transformer": "^0.5.1", "class-validator": "^0.14.1", "crypto-browserify": "^3.12.0", - "cuzz": "github:demergent-labs/cuzz#8f07ef174570bbb142e84516c55ec598a09c625c", + "cuzz": "github:demergent-labs/cuzz#e9dcc6fc2f4d55ef880469cbe836b8730b530d07", "deep-is": "^0.1.4", "esbuild": "^0.24.0", "esbuild-plugin-tsc": "^0.4.0", diff --git a/test/fuzz.ts b/test/fuzz.ts index 6f62441408..afe645c263 100644 --- a/test/fuzz.ts +++ b/test/fuzz.ts @@ -61,10 +61,13 @@ function fuzzTestCanister(canisterName: string, callDelay: string): void { '--clear-console' ]; - const cuzzArgs = - process.env.AZLE_FUZZ_TERMINAL === 'true' - ? [...baseCuzzArgs, '--terminal'] - : baseCuzzArgs; + const cuzzArgs = [ + ...baseCuzzArgs, + ...(process.env.AZLE_FUZZ_TERMINAL === 'true' ? ['--terminal'] : []), + ...(process.env.AZLE_FUZZ_TIME_LIMIT !== undefined + ? ['--time-limit', process.env.AZLE_FUZZ_TIME_LIMIT] + : []) + ]; let cuzzProcess = spawn('node_modules/.bin/cuzz', cuzzArgs, { stdio: 'inherit'