Skip to content

Commit c30dcd8

Browse files
committed
pytest: Fix a flaky channel_reenable test
It was relying on the message order instead of waiting the desired state. Signed-off-by: Christian Decker <[email protected]>
1 parent ee34350 commit c30dcd8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_lightningd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ def test_channel_reenable(self):
23022302
l2.daemon.wait_for_log('Received node_announcement for node {}'.format(l1.info['id']))
23032303

23042304
# Both directions should be active before the restart
2305-
assert [c['active'] for c in l1.rpc.getchannels()['channels']] == [True, True]
2305+
wait_for(lambda: [c['active'] for c in l1.rpc.getchannels()['channels']] == [True, True])
23062306

23072307
# Restart l2, will cause l1 to reconnect
23082308
l2.stop()
@@ -2311,7 +2311,7 @@ def test_channel_reenable(self):
23112311
# Now they should sync and re-establish again
23122312
l1.daemon.wait_for_log('Received node_announcement for node {}'.format(l2.info['id']))
23132313
l2.daemon.wait_for_log('Received node_announcement for node {}'.format(l1.info['id']))
2314-
assert [c['active'] for c in l1.rpc.getchannels()['channels']] == [True, True]
2314+
wait_for(lambda: [c['active'] for c in l1.rpc.getchannels()['channels']] == [True, True])
23152315

23162316
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
23172317
def test_update_fee(self):

0 commit comments

Comments
 (0)