Test that we kick out in-connection transient connections
(node_factory, bitcoind, executor)
| 4539 | |
| 4540 | |
| 4541 | def test_connect_transient_pending(node_factory, bitcoind, executor): |
| 4542 | """Test that we kick out in-connection transient connections""" |
| 4543 | l1, l2, l3, l4 = node_factory.get_nodes(4, opts=[{}, |
| 4544 | {'dev-handshake-no-reply': None}, |
| 4545 | {'dev-handshake-no-reply': None}, |
| 4546 | {}]) |
| 4547 | |
| 4548 | # This will block... |
| 4549 | fut1 = executor.submit(l1.rpc.connect, l2.info['id'], 'localhost', l2.port) |
| 4550 | fut2 = executor.submit(l1.rpc.connect, l3.info['id'], 'localhost', l3.port) |
| 4551 | |
| 4552 | assert not l1.daemon.is_in_log("due to stress, closing transient connect attempt") |
| 4553 | |
| 4554 | # Wait until those connects in progress. |
| 4555 | l2.daemon.wait_for_log("Connect IN") |
| 4556 | l3.daemon.wait_for_log("Connect IN") |
| 4557 | |
| 4558 | # Now force exhaustion. |
| 4559 | l1.rpc.dev_connectd_exhaust_fds() |
| 4560 | |
| 4561 | # This one will kick out one of the others. |
| 4562 | l1.rpc.connect(l4.info['id'], 'localhost', l4.port) |
| 4563 | line = l1.daemon.wait_for_log("due to stress, closing transient connect attempt") |
| 4564 | peerid = re.search(r'due to stress, closing transient connect attempt to (.*)', line).groups()[0] |
| 4565 | |
| 4566 | with pytest.raises(RpcError, match="Terminated due to too many connections"): |
| 4567 | if peerid == l2.info['id']: |
| 4568 | fut1.result(TIMEOUT) |
| 4569 | else: |
| 4570 | fut2.result(TIMEOUT) |
| 4571 | |
| 4572 | |
| 4573 | def test_onionmessage_unknown_invoice_no_leak(node_factory): |
nothing calls this directly
no test coverage detected