Make sure --daemon at least vaguely works!
(node_factory)
| 1340 | |
| 1341 | |
| 1342 | def test_daemon_option(node_factory): |
| 1343 | """ |
| 1344 | Make sure --daemon at least vaguely works! |
| 1345 | """ |
| 1346 | # Lazy way to set up command line and env, plus do VALGRIND checks |
| 1347 | l1 = node_factory.get_node() |
| 1348 | l1.stop() |
| 1349 | |
| 1350 | os.unlink(l1.rpc.socket_path) |
| 1351 | # Stop it from logging to stdout! |
| 1352 | logfname = os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, "log-daemon") |
| 1353 | l1.daemon.opts['log-file'] = logfname |
| 1354 | l1.daemon.opts['daemon'] = None |
| 1355 | subprocess.run(l1.daemon.cmd_line, env=l1.daemon.env, |
| 1356 | check=True) |
| 1357 | |
| 1358 | # Test some known output (wait for rpc to be ready) |
| 1359 | wait_for(lambda: os.path.exists(l1.rpc.socket_path)) |
| 1360 | out = subprocess.check_output(['cli/lightning-cli', |
| 1361 | '--network={}'.format(TEST_NETWORK), |
| 1362 | '--lightning-dir={}' |
| 1363 | .format(l1.daemon.lightning_dir), |
| 1364 | 'help']).decode('utf-8') |
| 1365 | assert 'addgossip message\n\naddoutpointwatch' in out |
| 1366 | |
| 1367 | subprocess.run(['cli/lightning-cli', |
| 1368 | '--network={}'.format(TEST_NETWORK), |
| 1369 | '--lightning-dir={}'.format(l1.daemon.lightning_dir), |
| 1370 | 'stop'], check=True) |
| 1371 | |
| 1372 | # It should not complain that subdaemons aren't children. |
| 1373 | with open(logfname, 'r') as f: |
| 1374 | assert 'No child process' not in f.read() |
| 1375 | |
| 1376 | |
| 1377 | def test_cli_no_argument(): |