test_lightningd.py: catch unexpected reconnections.

I had a weird failure which was caused by an unexpected disconnect and
reconnecct.  Since we are prersistend and recover from these, they can
slip through our tests; most tests don't involve reconnection, so we
need to catch this explicitly.

For the connect() helper, we always suppress reconnection; tests which
want it all want other options so don't use this helper anyway.  (Actually,
after I said that, test_closing_while_disconnected was added when I
rebased, which did require it, so I had to open-code that one).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-04-23 19:37:44 +09:30
parent 05ba976a41
commit d0bfd8407a
2 changed files with 83 additions and 50 deletions

View File

@@ -299,12 +299,13 @@ class LightningD(TailableProc):
class LightningNode(object):
def __init__(self, daemon, rpc, btc, executor, may_fail=False):
def __init__(self, daemon, rpc, btc, executor, may_fail=False, may_reconnect=False):
self.rpc = rpc
self.daemon = daemon
self.bitcoin = btc
self.executor = executor
self.may_fail = may_fail
self.may_reconnect = may_reconnect
# Use batch if you're doing more than one async.
def connect(self, remote_node, capacity, async=False):