mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
pytest: Remember a node's return code so we can check it later
This commit is contained in:
@@ -551,6 +551,9 @@ class LightningNode(object):
|
|||||||
self.allow_bad_gossip = allow_bad_gossip
|
self.allow_bad_gossip = allow_bad_gossip
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|
||||||
|
# Assume successful exit
|
||||||
|
self.rc = 0
|
||||||
|
|
||||||
socket_path = os.path.join(lightning_dir, TEST_NETWORK, "lightning-rpc").format(node_id)
|
socket_path = os.path.join(lightning_dir, TEST_NETWORK, "lightning-rpc").format(node_id)
|
||||||
self.rpc = LightningRpc(socket_path, self.executor)
|
self.rpc = LightningRpc(socket_path, self.executor)
|
||||||
|
|
||||||
@@ -665,19 +668,19 @@ class LightningNode(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
rc = self.daemon.wait(timeout)
|
self.rc = self.daemon.wait(timeout)
|
||||||
|
|
||||||
# If it did not stop be more insistent
|
# If it did not stop be more insistent
|
||||||
if rc is None:
|
if self.rc is None:
|
||||||
rc = self.daemon.stop()
|
self.rc = self.daemon.stop()
|
||||||
|
|
||||||
self.daemon.save_log()
|
self.daemon.save_log()
|
||||||
self.daemon.cleanup()
|
self.daemon.cleanup()
|
||||||
|
|
||||||
if rc != 0 and not self.may_fail:
|
if self.rc != 0 and not self.may_fail:
|
||||||
raise ValueError("Node did not exit cleanly, rc={}".format(rc))
|
raise ValueError("Node did not exit cleanly, rc={}".format(self.rc))
|
||||||
else:
|
else:
|
||||||
return rc
|
return self.rc
|
||||||
|
|
||||||
def restart(self, timeout=10, clean=True):
|
def restart(self, timeout=10, clean=True):
|
||||||
"""Stop and restart the lightning node.
|
"""Stop and restart the lightning node.
|
||||||
|
|||||||
Reference in New Issue
Block a user