Skip to content

Commit

Permalink
pytest: Making test_routing_gossip less flaky
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Decker <[email protected]>
  • Loading branch information
cdecker authored and rustyrussell committed May 31, 2018
1 parent 16b7aab commit 568cd9f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/test_lightningd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2663,14 +2663,20 @@ def test_routing_gossip(self):
comb.append((nodes[i].info['id'], nodes[i + 1].info['id']))
comb.append((nodes[i + 1].info['id'], nodes[i].info['id']))

def check_gossip(n):
seen = []
channels = n.rpc.listchannels()['channels']
for c in channels:
seen.append((c['source'], c['destination']))
missing = set(comb) - set(seen)
logging.debug("Node {id} is missing channels {chans}".format(
id=n.info['id'],
chans=missing)
)
return len(missing) == 0

for n in nodes:
def check_gossip():
seen = []
channels = n.rpc.listchannels()['channels']
for c in channels:
seen.append((c['source'], c['destination']))
return set(seen) == set(comb)
wait_for(check_gossip)
wait_for(lambda: check_gossip(n), interval=1)

@unittest.skipIf(not DEVELOPER, "Too slow without --dev-bitcoind-poll")
def test_forward(self):
Expand Down

0 comments on commit 568cd9f

Please sign in to comment.