Must read config file before chdir into lightning dir
(node_factory)
| 2028 | |
| 2029 | |
| 2030 | def test_configfile_before_chdir(node_factory): |
| 2031 | """Must read config file before chdir into lightning dir""" |
| 2032 | l1 = node_factory.get_node() |
| 2033 | l1.stop() |
| 2034 | |
| 2035 | olddir = os.getcwd() |
| 2036 | # as lightning_dir ends in /, basename and dirname don't work as expected. |
| 2037 | os.chdir(os.path.dirname(l1.daemon.lightning_dir[:-1])) |
| 2038 | config = os.path.join(os.path.basename(l1.daemon.lightning_dir[:-1]), TEST_NETWORK, "test_configfile") |
| 2039 | # Test both an early arg and a normal arg. |
| 2040 | with open(config, 'wb') as f: |
| 2041 | f.write(b'always-use-proxy=true\n') |
| 2042 | f.write(b'proxy=127.0.0.1:100\n') |
| 2043 | l1.daemon.opts['conf'] = config |
| 2044 | |
| 2045 | # Update executable to point to right place |
| 2046 | l1.daemon.executable = os.path.join(olddir, l1.daemon.executable) |
| 2047 | l1.start() |
| 2048 | assert l1.rpc.listconfigs()['configs']['always-use-proxy'] == {'source': os.path.abspath(config) + ":1", 'value_bool': True} |
| 2049 | assert l1.rpc.listconfigs()['configs']['proxy'] == {'source': os.path.abspath(config) + ":2", 'value_str': '127.0.0.1:100'} |
| 2050 | os.chdir(olddir) |
| 2051 | |
| 2052 | |
| 2053 | def test_json_error(node_factory): |