(node_factory, executor)
| 242 | |
| 243 | |
| 244 | def test_connection_moved(node_factory, executor): |
| 245 | slow_start = os.path.join(os.getcwd(), 'tests/plugins/slow_start.py') |
| 246 | options = {'may_reconnect': True, 'plugin': slow_start} |
| 247 | l1, l2 = node_factory.get_nodes(2, opts=options) |
| 248 | |
| 249 | # Set up the plugin to wait for a connection |
| 250 | executor.submit(l1.rpc.waitconn) |
| 251 | log = l1.daemon.wait_for_log('listening for connections') |
| 252 | match = re.search(r'on port (\d*)', log) |
| 253 | assert match and len(match.groups()) == 1 |
| 254 | hang_port = int(match.groups()[0]) |
| 255 | |
| 256 | # Attempt connection |
| 257 | fut_hang = executor.submit(l1.rpc.connect, l2.info['id'], |
| 258 | 'localhost', hang_port) |
| 259 | l1.daemon.wait_for_log('connection from') |
| 260 | |
| 261 | # Provide correct connection details |
| 262 | ret = l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 263 | assert ret['address'] == {'type': 'ipv4', 'address': '127.0.0.1', 'port': l2.port} |
| 264 | |
| 265 | # If we failed to update the connection, this call will error |
| 266 | fut_hang.result(TIMEOUT) |
| 267 | |
| 268 | |
| 269 | def test_balance(node_factory): |
nothing calls this directly
no test coverage detected