pytest: test for parallel refresh.

If we do this, we get a database error (now we try to refresh
intelligently, is this is currently only chainmoves / channelmoves).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2025-08-19 10:30:46 +09:30
parent 3ae222540b
commit 0ff1c7ab0c

View file

@ -4258,6 +4258,20 @@ def test_sql_crash(node_factory, bitcoind):
l1.rpc.sql(f"SELECT * FROM peerchannels;")
@pytest.mark.xfail(strict=True)
def test_sql_parallel(node_factory, executor):
"""Parallel refreshes of tables causes SQL errors:
Error executing INSERT INTO chainmoves VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?); on row 0: UNIQUE constraint failed: chainmoves.created_index
"""
l1, l2 = node_factory.line_graph(2)
futs = []
for _ in range(5):
futs.append(executor.submit(l1.rpc.sql, "SELECT * FROM chainmoves"))
for f in futs:
f.result(TIMEOUT)
def test_listchannels_broken_message(node_factory):
"""This gave a bogus BROKEN message with deprecated-apis enabled"""
l1 = node_factory.get_node(options={'allow-deprecated-apis': True})