test: Scale feature_dbcrash.py timeout with factor

This allows to run the test under valgrind:

./bld-cmake/test/functional/feature_dbcrash.py --timeout-factor=10 --valgrind

For testing, the same test can be run multiple times in parallel:

./bld-cmake/test/functional/test_runner.py -j 10 $( printf 'feature_dbcrash.py %.0s' {1..10} )  --timeout-factor=10 --valgrind

(Running the test under valgrind may take several hours!)

I found that before this commit, 9 out of the 10 runs failed via:

```
...
TestFramework (INFO): Iteration 36, generating 2500 transactions [11, 5, 6]
TestFramework (ERROR): Unexpected exception
Traceback (most recent call last):
  File "/b-c/test/functional/test_framework/test_framework.py", line 142, in main
    self.run_test()
    ~~~~~~~~~~~~~^^
  File "/b-c/bld-cmake/test/functional/feature_dbcrash.py", line 262, in run_test
    self.sync_node3blocks(block_hashes)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/b-c/bld-cmake/test/functional/feature_dbcrash.py", line 151, in sync_node3blocks
    nodei_utxo_hash = self.restart_node(i, block_hash)
  File "/b-c/bld-cmake/test/functional/feature_dbcrash.py", line 102, in restart_node
    raise AssertionError(f"Unable to successfully restart node {node_index} in allotted time")
AssertionError: Unable to successfully restart node 0 in allotted time
```

With this commit, all 10 runs passed.
This commit is contained in:
MarcoFalke
2026-02-16 10:44:28 +01:00
parent d3056bc149
commit fadb77169b

View File

@@ -80,7 +80,7 @@ class ChainstateWriteCrashTest(BitcoinTestFramework):
after a timeout. Returns the utxo hash of the given node."""
time_start = time.time()
while time.time() - time_start < 120:
while time.time() - time_start < 120 * self.options.timeout_factor:
try:
# Any of these RPC calls could throw due to node crash
self.start_node(node_index)