pytest: fix reconnect flake in test_plugin_connected_hook_chaining

```
         l1.rpc.reject(l3.info['id'])
     
         l2.connect(l1)
         l1.daemon.wait_for_logs([
             f"peer_connected_logger_a {l2id}",
             f"{l2id} is allowed",
             f"peer_connected_logger_b {l2id}"
         ])
         assert len(l1.rpc.listpeers(l2id)['peers']) == 1
     
 >       l3.connect(l1)
 tests/test_plugin.py:468: 
... 
 >           raise RpcError(method, payload, resp['error'])
 E           pyln.client.lightning.RpcError: RPC call failed: method: connect, payload: {'id': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'host': '127.0.0.1', 'port': 42391}, error: {'code': 402, 'message': 'disconnected during connection'}
 
 contrib/pyln-client/pyln/client/lightning.py:422: RpcError
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-06-23 13:21:24 +09:30
parent ffb0f03e1a
commit 71adeccfbf

View file

@ -465,7 +465,13 @@ def test_plugin_connected_hook_chaining(node_factory):
])
assert len(l1.rpc.listpeers(l2id)['peers']) == 1
l3.connect(l1)
# If reject happens fast enough, connect fails with "disconnected
# during connection"
try:
l3.connect(l1)
except RpcError as err:
assert "disconnected during connection" in err.error
l1.daemon.wait_for_logs([
f"peer_connected_logger_a {l3id}",
f"{l3id} is in reject list"