Skip to content

Commit 71adecc

Browse files
committed
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 <[email protected]>
1 parent ffb0f03 commit 71adecc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_plugin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,13 @@ def test_plugin_connected_hook_chaining(node_factory):
465465
])
466466
assert len(l1.rpc.listpeers(l2id)['peers']) == 1
467467

468-
l3.connect(l1)
468+
# If reject happens fast enough, connect fails with "disconnected
469+
# during connection"
470+
try:
471+
l3.connect(l1)
472+
except RpcError as err:
473+
assert "disconnected during connection" in err.error
474+
469475
l1.daemon.wait_for_logs([
470476
f"peer_connected_logger_a {l3id}",
471477
f"{l3id} is in reject list"

0 commit comments

Comments
 (0)