Skip to content

Commit

Permalink
pytest: fix flake in test_channel_lease_unilat_closes
Browse files Browse the repository at this point in the history
We actually were waiting for l3 to disconnect, not l2.

But in general we should be looking for status rather than grovelling
in the logs where possible, so I changed all those.

```
2021-08-17T04:40:34.9015538Z         # l2 leases a channel from l3
2021-08-17T04:40:34.9016520Z         l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
2021-08-17T04:40:34.9017570Z         rates = l2.rpc.dev_queryrates(l3.info['id'], amount, amount)
2021-08-17T04:40:34.9018724Z         l3.daemon.wait_for_log('disconnect')
2021-08-17T04:40:34.9019851Z         l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
2021-08-17T04:40:34.9021467Z         l2.rpc.fundchannel(l3.info['id'], amount, request_amt=amount,
2021-08-17T04:40:34.9022865Z                            feerate='{}perkw'.format(feerate), minconf=0,
2021-08-17T04:40:34.9024000Z >                          compact_lease=rates['compact_lease'])
...
2021-08-17T04:40:34.9103422Z >           raise RpcError(method, payload, resp['error'])
2021-08-17T04:40:34.9106829Z E           pyln.client.lightning.RpcError: RPC call failed: method: fundchannel, payload: {'id': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d', 'amount': 500000, 'feerate': '2000perkw', 'announce': True, 'minconf': 0, 'request_amt': 500000, 'compact_lease': '029a00640064000000644c4b40'}, error: {'code': 400, 'message': 'Unable to connect, no address known for peer', 'data': {'id': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d', 'method': 'connect'}}
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell authored and niftynei committed Aug 19, 2021
1 parent 4514d2a commit 12fbb23
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def test_channel_lease_falls_behind(node_factory, bitcoind):

l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
rates = l1.rpc.dev_queryrates(l2.info['id'], amount, amount)
l1.daemon.wait_for_log('disconnect')
wait_for(lambda: len(l1.rpc.listpeers(l2.info['id'])['peers']) == 0)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# l1 leases a channel from l2
l1.rpc.fundchannel(l2.info['id'], amount, request_amt=amount,
Expand Down Expand Up @@ -779,7 +779,7 @@ def test_channel_lease_post_expiry(node_factory, bitcoind):
# l1 leases a channel from l2
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
rates = l1.rpc.dev_queryrates(l2.info['id'], amount, amount)
l1.daemon.wait_for_log('disconnect')
wait_for(lambda: len(l1.rpc.listpeers(l2.info['id'])['peers']) == 0)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l1.rpc.fundchannel(l2.info['id'], amount, request_amt=amount,
feerate='{}perkw'.format(feerate),
Expand Down Expand Up @@ -864,7 +864,7 @@ def test_channel_lease_unilat_closes(node_factory, bitcoind):

l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
rates = l1.rpc.dev_queryrates(l2.info['id'], amount, amount)
l1.daemon.wait_for_log('disconnect')
wait_for(lambda: len(l1.rpc.listpeers(l2.info['id'])['peers']) == 0)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# l1 leases a channel from l2
l1.rpc.fundchannel(l2.info['id'], amount, request_amt=amount,
Expand All @@ -874,7 +874,7 @@ def test_channel_lease_unilat_closes(node_factory, bitcoind):
# l2 leases a channel from l3
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
rates = l2.rpc.dev_queryrates(l3.info['id'], amount, amount)
l3.daemon.wait_for_log('disconnect')
wait_for(lambda: len(l2.rpc.listpeers(l3.info['id'])['peers']) == 0)
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
l2.rpc.fundchannel(l3.info['id'], amount, request_amt=amount,
feerate='{}perkw'.format(feerate), minconf=0,
Expand Down Expand Up @@ -965,7 +965,7 @@ def test_channel_lease_lessor_cheat(node_factory, bitcoind, chainparams):

l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
rates = l1.rpc.dev_queryrates(l2.info['id'], amount, amount)
l1.daemon.wait_for_log('disconnect')
wait_for(lambda: len(l1.rpc.listpeers(l2.info['id'])['peers']) == 0)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# l1 leases a channel from l2
l1.rpc.fundchannel(l2.info['id'], amount, request_amt=amount,
Expand Down Expand Up @@ -1038,7 +1038,7 @@ def test_channel_lease_lessee_cheat(node_factory, bitcoind, chainparams):

l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
rates = l1.rpc.dev_queryrates(l2.info['id'], amount, amount)
l1.daemon.wait_for_log('disconnect')
wait_for(lambda: len(l1.rpc.listpeers(l2.info['id'])['peers']) == 0)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# l1 leases a channel from l2
l1.rpc.fundchannel(l2.info['id'], amount, request_amt=amount,
Expand Down

0 comments on commit 12fbb23

Please sign in to comment.