Skip to content

Commit 79d39e0

Browse files
committed
pytest: fix flake in test_onionmessage_ratelimit
Sometimes l1 ratelimits before l2, and l2 receives the warning message, not l1: ``` > assert l1.daemon.is_in_log('WARNING: Ratelimited onion_message: exceeded one per 250msec') E AssertionError: assert None E + where None = <bound method TailableProc.is_in_log of <pyln.testing.utils.LightningD object at 0x7f13435f45b0>>('WARNING: Ratelimited onion_message: exceeded one per 250msec') E + where <bound method TailableProc.is_in_log of <pyln.testing.utils.LightningD object at 0x7f13435f45b0>> = <pyln.testing.utils.LightningD object at 0x7f13435f45b0>.is_in_log E + where <pyln.testing.utils.LightningD object at 0x7f13435f45b0> = <fixtures.LightningNode object at 0x7f13435cbb80>.daemon ... lightningd-1 2024-11-19T00:45:43.721Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-connectd: peer_in WIRE_ONION_MESSAGE lightningd-1 2024-11-19T00:45:43.721Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-connectd: peer_out WIRE_WARNING lightningd-2 2024-11-19T00:45:43.722Z DEBUG 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: peer_out WIRE_ONION_MESSAGE lightningd-2 2024-11-19T00:45:43.722Z DEBUG connectd: REPLY WIRE_CONNECTD_INJECT_ONIONMSG_REPLY with 0 fds lightningd-2 2024-11-19T00:45:43.722Z DEBUG 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: peer_in WIRE_WARNING lightningd-2 2024-11-19T00:45:43.722Z INFO 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: Received WIRE_WARNING: WARNING: Ratelimited onion_message: exceeded one per 250msec ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent c4f8716 commit 79d39e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_pay.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5784,7 +5784,9 @@ def test_onionmessage_ratelimit(node_factory):
57845784
for _ in range(8):
57855785
l1.rpc.fetchinvoice(offer['bolt12'])
57865786

5787-
assert l1.daemon.is_in_log('WARNING: Ratelimited onion_message: exceeded one per 250msec')
5787+
# Normally l2 gets upset, but actually l1 can get upset with replies!
5788+
assert (l1.daemon.is_in_log('WARNING: Ratelimited onion_message: exceeded one per 250msec')
5789+
or l2.daemon.is_in_log('WARNING: Ratelimited onion_message: exceeded one per 250msec'))
57885790

57895791
# It will recover though!
57905792
time.sleep(0.250)

0 commit comments

Comments
 (0)