Skip to content

Commit c4f8716

Browse files
committed
pytest: fix race in test_autoclean.
We can see the log message about cleanup just after the test ends. ``` > assert l3.rpc.autoclean_status()['autoclean']['expiredinvoices']['cleaned'] == 1 E assert 0 == 1 tests/test_plugin.py:3232: AssertionError ``` ... ``` lightningd-3 2024-11-18T07:52:55.402Z INFO lightningd: setconfig: autoclean-cycle 10 (updated /tmp/ltests-ao0p8pem/test_autoclean_1/lightning-3/regtest/config:4) ... lightningd-3 2024-11-18T07:52:59.747Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-connectd: peer_out WIRE_QUERY_CHANNEL_RANGE lightningd-3 2024-11-18T07:52:59.747Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-gossipd: reply_channel_range 0+109 (of 0+109) 2 scids lightningd-3 2024-11-18T07:52:59.747Z DEBUG gossipd: seeker: state = NORMAL No unannounced nodes {'github_repository': 'ElementsProject/lightning', 'github_sha': '0729de783e95c5208b1706f7d27b23904596bb71', 'github_ref': 'refs/pull/7835/merge', 'github_ref_name': 'HEAD', 'github_run_id': 11887300979, 'github_head_ref': 'guilt/fix-flakes8', 'github_run_number': 11566, 'github_base_ref': 'master', 'github_run_attempt': '1', 'testname': 'test_autoclean', 'start_time': 1731916359, 'end_time': 1731916385, 'outcome': 'fail'} --------------------------- Captured stdout teardown --------------------------- lightningd-3 2024-11-18T07:53:05.503Z DEBUG plugin-autoclean: cleaned 1 from expiredinvoices lightningd-3 2024-11-18T07:53:05.503Z DEBUG plugin-autoclean: setting next timer ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 1e8cbf2 commit c4f8716

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test_plugin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3229,7 +3229,8 @@ def test_autoclean(node_factory):
32293229
assert only_one(invs)['status'] == 'unpaid'
32303230
time.sleep(1)
32313231

3232-
assert l3.rpc.autoclean_status()['autoclean']['expiredinvoices']['cleaned'] == 1
3232+
# We can actually race between the delete and this being updated!
3233+
wait_for(lambda: l3.rpc.autoclean_status()['autoclean']['expiredinvoices']['cleaned'] == 1)
32333234

32343235
# Keeps settings across restarts
32353236
l3.restart()

0 commit comments

Comments
 (0)