From aca46bb04680e15df5d2f06ef86ce994dc3c2737 Mon Sep 17 00:00:00 2001 From: Salvatore Ingala <6681844+bigspider@users.noreply.github.com> Date: Wed, 19 Apr 2023 09:36:38 +0200 Subject: [PATCH] Add a default 5-min test timeout in ci tests (except for very long tests, that are disabled by default) --- .github/workflows/ci-workflow.yml | 6 +++--- bitcoin_client/tests/requirements.txt | 1 + tests/requirements.txt | 1 + tests/test_e2e_multisig.py | 1 + tests/test_sign_psbt.py | 1 + tests/test_sign_psbt_v1.py | 1 + tests_mainnet/requirements.txt | 1 + 7 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 1dfd433df..27f0c526b 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -138,7 +138,7 @@ jobs: run: | cd tests pip install -r requirements.txt - PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} + PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=300 job_test_mainnet: name: Tests on mainnet @@ -178,7 +178,7 @@ jobs: run: | cd tests_mainnet pip install -r requirements.txt - PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} + PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=300 job_test_python_lib_legacyapp: name: Tests with the Python library and legacy Bitcoin app @@ -204,7 +204,7 @@ jobs: run: | cd bitcoin_client/tests pip install -r requirements.txt - PYTHONPATH=$PYTHONPATH:/speculos pytest --headless + PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --timeout=300 job_test_js_lib: diff --git a/bitcoin_client/tests/requirements.txt b/bitcoin_client/tests/requirements.txt index 58945f429..4127c1405 100644 --- a/bitcoin_client/tests/requirements.txt +++ b/bitcoin_client/tests/requirements.txt @@ -1,4 +1,5 @@ pytest>=6.1.1,<7.0.0 +pytest-timeout>=2.1.0,<3.0.0 ledgercomm>=1.1.0,<1.2.0 ecdsa>=0.16.1,<0.17.0 typing-extensions>=3.7,<4.0 diff --git a/tests/requirements.txt b/tests/requirements.txt index 58945f429..4127c1405 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,5 @@ pytest>=6.1.1,<7.0.0 +pytest-timeout>=2.1.0,<3.0.0 ledgercomm>=1.1.0,<1.2.0 ecdsa>=0.16.1,<0.17.0 typing-extensions>=3.7,<4.0 diff --git a/tests/test_e2e_multisig.py b/tests/test_e2e_multisig.py index 35eaacdd4..7cc476be9 100644 --- a/tests/test_e2e_multisig.py +++ b/tests/test_e2e_multisig.py @@ -168,6 +168,7 @@ def test_e2e_multisig_multiple_internal_keys(rpc: AuthServiceProxy, rpc_test_wal rpc, rpc_test_wallet, client, speculos_globals, comm) +@pytest.mark.timeout(0) # disable timeout def test_e2e_multisig_16_of_16(rpc: AuthServiceProxy, rpc_test_wallet, client: Client, speculos_globals: SpeculosGlobals, comm: Union[TransportClient, SpeculosClient], enable_slow_tests: bool): # Largest supported multisig with sortedmulti. # The time for an end-to-end execution on a real Ledger Nano S (including user's input) is about 520 seconds. diff --git a/tests/test_sign_psbt.py b/tests/test_sign_psbt.py index 97922f1ad..a6d630516 100644 --- a/tests/test_sign_psbt.py +++ b/tests/test_sign_psbt.py @@ -666,6 +666,7 @@ def test_sign_psbt_singlesig_large_amount(client: Client, comm: SpeculosClient, (parsed_events["amounts"][0] == format_amount(CURRENCY_TICKER_ALT, out_amt))) +@pytest.mark.timeout(0) # disable timeout @has_automation("automations/sign_with_default_wallet_accept.json") def test_sign_psbt_singlesig_wpkh_512to256(client: Client, enable_slow_tests: bool): # PSBT for a transaction with 512 inputs and 256 outputs (maximum currently supported in the app) diff --git a/tests/test_sign_psbt_v1.py b/tests/test_sign_psbt_v1.py index 99d2a67e8..ced263fe6 100644 --- a/tests/test_sign_psbt_v1.py +++ b/tests/test_sign_psbt_v1.py @@ -487,6 +487,7 @@ def test_sign_psbt_singlesig_large_amount_v1(client: Client, comm: SpeculosClien (parsed_events["amounts"][0] == format_amount(CURRENCY_TICKER_ALT, out_amt))) +@pytest.mark.timeout(0) # disable timeout @has_automation("automations/sign_with_default_wallet_accept.json") def test_sign_psbt_singlesig_wpkh_512to256_v1(client: Client, enable_slow_tests: bool): # PSBT for a transaction with 512 inputs and 256 outputs (maximum currently supported in the app) diff --git a/tests_mainnet/requirements.txt b/tests_mainnet/requirements.txt index 58945f429..4127c1405 100644 --- a/tests_mainnet/requirements.txt +++ b/tests_mainnet/requirements.txt @@ -1,4 +1,5 @@ pytest>=6.1.1,<7.0.0 +pytest-timeout>=2.1.0,<3.0.0 ledgercomm>=1.1.0,<1.2.0 ecdsa>=0.16.1,<0.17.0 typing-extensions>=3.7,<4.0