revault / revaultd

The "wallet" daemon for participants under the Revault architecture
BSD 3-Clause "New" or "Revised" License
49 stars 21 forks source link

`test_gethistory` is racy #396

Closed darosior closed 2 years ago

darosior commented 2 years ago

On master you can reproduce by first removing the delays between polling bitcoind:

diff --git a/tests/test_framework/revaultd.py b/tests/test_framework/revaultd.py
index 1fe1ec7..008ec2f 100644
--- a/tests/test_framework/revaultd.py
+++ b/tests/test_framework/revaultd.py
@@ -76,7 +76,7 @@ class Revaultd(TailableProc):
             f.write('network = "regtest"\n')
             f.write(f"cookie_path = '{bitcoind_cookie_path}'\n")
             f.write(f"addr = '127.0.0.1:{bitcoind_rpc_port}'\n")
-            f.write("poll_interval_secs = 10\n")
+            f.write("poll_interval_secs = 0\n")

             if stk_config is not None:
                 f.write("[stakeholder_config]\n")

And running it enough times to trigger the race (shouldn't be hard to trigger with the above patch which exacerbates the race):

cargo build --release && REVAULTD_PATH=$PWD/target/release/revaultd POSTGRES_PASS=revault POSTGRES_USER=revault pytest -vvv --ignore tests/servers/ -k gethistory --dist each -n 10