From 896ecb4da78bae6ab1c1921136b44b7cdfd57bde Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 11 Jan 2018 10:44:20 +1030 Subject: [PATCH] test_lightning: don't fire prematurely on test_gossip_jsonrpc. We wait the the receipt of the CHANNEL_UPDATE message by channeld, but that doesn't mean it reached gossipd yet, causing spurious test failure. Signed-off-by: Rusty Russell --- tests/test_lightningd.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index b0b2b0996..24e45d5b6 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -1375,20 +1375,22 @@ class LightningDTests(BaseLightningDTests): l1.daemon.wait_for_logs(['peer_out WIRE_ANNOUNCEMENT_SIGNATURES', 'peer_in WIRE_ANNOUNCEMENT_SIGNATURES']) - # Could happen in either order. + channel_id = channels[0]['short_channel_id'] + # Could happen in any order. l1.daemon.wait_for_logs(['peer_out WIRE_CHANNEL_ANNOUNCEMENT', - 'peer_in WIRE_CHANNEL_ANNOUNCEMENT']) + 'peer_in WIRE_CHANNEL_ANNOUNCEMENT', + 'Channel {}\\(0\\) was updated.' + .format(channel_id), + 'Channel {}\\(1\\) was updated.' + .format(channel_id)]) nodes = l1.rpc.getnodes()['nodes'] assert set([n['nodeid'] for n in nodes]) == set([l1.info['id'], l2.info['id']]) - l1.daemon.wait_for_log('peer_in WIRE_CHANNEL_UPDATE') - l2.daemon.wait_for_log('peer_in WIRE_CHANNEL_UPDATE') - - wait_for(lambda: [c['active'] for c in l1.rpc.getchannels()['channels']] == [True, True]) - wait_for(lambda: [c['public'] for c in l1.rpc.getchannels()['channels']] == [True, True]) - wait_for(lambda: [c['active'] for c in l2.rpc.getchannels()['channels']] == [True, True]) - wait_for(lambda: [c['public'] for c in l2.rpc.getchannels()['channels']] == [True, True]) + assert [c['active'] for c in l1.rpc.getchannels()['channels']] == [True, True] + assert [c['public'] for c in l1.rpc.getchannels()['channels']] == [True, True] + assert [c['active'] for c in l2.rpc.getchannels()['channels']] == [True, True] + assert [c['public'] for c in l2.rpc.getchannels()['channels']] == [True, True] def ping_tests(self, l1, l2): # 0-byte pong gives just type + length field.