(node_factory, executor)
| 294 | |
| 295 | |
| 296 | def test_connection_moved(node_factory, executor): |
| 297 | slow_start = os.path.join(os.getcwd(), 'tests/plugins/slow_start.py') |
| 298 | options = {'may_reconnect': True, 'plugin': slow_start} |
| 299 | l1, l2 = node_factory.get_nodes(2, opts=options) |
| 300 | |
| 301 | # Set up the plugin to wait for a connection |
| 302 | executor.submit(l1.rpc.waitconn) |
| 303 | log = l1.daemon.wait_for_log('listening for connections') |
| 304 | match = re.search(r'on port (\d*)', log) |
| 305 | assert match and len(match.groups()) == 1 |
| 306 | hang_port = int(match.groups()[0]) |
| 307 | |
| 308 | # Attempt connection |
| 309 | fut_hang = executor.submit(l1.rpc.connect, l2.info['id'], |
| 310 | 'localhost', hang_port) |
| 311 | l1.daemon.wait_for_log('connection from') |
| 312 | |
| 313 | # Provide correct connection details |
| 314 | ret = l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 315 | assert ret['address'] == {'type': 'ipv4', 'address': '127.0.0.1', 'port': l2.port} |
| 316 | |
| 317 | # If we failed to update the connection, this call will error |
| 318 | fut_hang.result(TIMEOUT) |
| 319 | |
| 320 | |
| 321 | def test_balance(node_factory): |
nothing calls this directly
no test coverage detected