mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
pyln-testing: add flag 'expect_fail' to node factory get_node
if the node fails to start (and we're expecting it to) return to us the node object anyway we also signal to collect all of its stderr logs by setting stderr on the tailableproc that backs the node
This commit is contained in:
committed by
Rusty Russell
parent
0cf3e19e0b
commit
34cef2cac3
@@ -990,7 +990,7 @@ class NodeFactory(object):
|
|||||||
|
|
||||||
def get_node(self, node_id=None, options=None, dbfile=None,
|
def get_node(self, node_id=None, options=None, dbfile=None,
|
||||||
feerates=(15000, 7500, 3750), start=True,
|
feerates=(15000, 7500, 3750), start=True,
|
||||||
wait_for_bitcoind_sync=True, **kwargs):
|
wait_for_bitcoind_sync=True, expect_fail=False, **kwargs):
|
||||||
|
|
||||||
node_id = self.get_node_id() if not node_id else node_id
|
node_id = self.get_node_id() if not node_id else node_id
|
||||||
port = self.get_next_port()
|
port = self.get_next_port()
|
||||||
@@ -1021,8 +1021,15 @@ class NodeFactory(object):
|
|||||||
|
|
||||||
if start:
|
if start:
|
||||||
try:
|
try:
|
||||||
node.start(wait_for_bitcoind_sync)
|
# Capture stderr if we're failing
|
||||||
|
if expect_fail:
|
||||||
|
stderr = subprocess.PIPE
|
||||||
|
else:
|
||||||
|
stderr = None
|
||||||
|
node.start(wait_for_bitcoind_sync, stderr=stderr)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
if expect_fail:
|
||||||
|
return node
|
||||||
node.daemon.stop()
|
node.daemon.stop()
|
||||||
raise
|
raise
|
||||||
return node
|
return node
|
||||||
|
|||||||
Reference in New Issue
Block a user