mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
pytest: test that we don't revert config handling again.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1036,3 +1036,26 @@ def test_crashlog(node_factory):
|
|||||||
assert not has_crash_log(l1)
|
assert not has_crash_log(l1)
|
||||||
l1.daemon.proc.send_signal(signal.SIGSEGV)
|
l1.daemon.proc.send_signal(signal.SIGSEGV)
|
||||||
wait_for(lambda: has_crash_log(l1))
|
wait_for(lambda: has_crash_log(l1))
|
||||||
|
|
||||||
|
|
||||||
|
def test_configfile_before_chdir(node_factory):
|
||||||
|
"""Must read config file before chdir into lightning dir"""
|
||||||
|
l1 = node_factory.get_node()
|
||||||
|
l1.stop()
|
||||||
|
|
||||||
|
olddir = os.getcwd()
|
||||||
|
# as lightning_dir ends in /, basename and dirname don't work as expected.
|
||||||
|
os.chdir(os.path.dirname(l1.daemon.lightning_dir[:-1]))
|
||||||
|
config = os.path.join(os.path.basename(l1.daemon.lightning_dir[:-1]), "test_configfile")
|
||||||
|
# Test both an early arg and a normal arg.
|
||||||
|
with open(config, 'wb') as f:
|
||||||
|
f.write(b'always-use-proxy=true\n')
|
||||||
|
f.write(b'proxy=127.0.0.1:100\n')
|
||||||
|
l1.daemon.opts['conf'] = config
|
||||||
|
|
||||||
|
# Update executable to point to right place
|
||||||
|
l1.daemon.executable = os.path.join(olddir, l1.daemon.executable)
|
||||||
|
l1.start()
|
||||||
|
assert l1.rpc.listconfigs()['always-use-proxy']
|
||||||
|
assert l1.rpc.listconfigs()['proxy'] == '127.0.0.1:100'
|
||||||
|
os.chdir(olddir)
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ class BitcoinD(TailableProc):
|
|||||||
class LightningD(TailableProc):
|
class LightningD(TailableProc):
|
||||||
def __init__(self, lightning_dir, bitcoind, port=9735, random_hsm=False, node_id=0):
|
def __init__(self, lightning_dir, bitcoind, port=9735, random_hsm=False, node_id=0):
|
||||||
TailableProc.__init__(self, lightning_dir)
|
TailableProc.__init__(self, lightning_dir)
|
||||||
|
self.executable = 'lightningd/lightningd'
|
||||||
self.lightning_dir = lightning_dir
|
self.lightning_dir = lightning_dir
|
||||||
self.port = port
|
self.port = port
|
||||||
self.cmd_prefix = []
|
self.cmd_prefix = []
|
||||||
@@ -351,7 +352,7 @@ class LightningD(TailableProc):
|
|||||||
else:
|
else:
|
||||||
opts.append("--{}={}".format(k, v))
|
opts.append("--{}={}".format(k, v))
|
||||||
|
|
||||||
return self.cmd_prefix + ['lightningd/lightningd'] + opts
|
return self.cmd_prefix + [self.executable] + opts
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.rpcproxy.start()
|
self.rpcproxy.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user