From 67d8fdcc7556ea1f1dcdf26f00e4eb7c2e4a20c8 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj jxPCSnmZ Date: Wed, 2 Dec 2020 10:27:17 +0800 Subject: [PATCH] tests/test_misc.py: Add a test for issue #4240. --- tests/test_misc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_misc.py b/tests/test_misc.py index 66f4798f5..4be50f9a5 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1532,6 +1532,7 @@ def test_feerates(node_factory): assert htlc_success_cost == htlc_feerate * 703 // 1000 +@pytest.mark.xfail(strict=True) def test_logging(node_factory): # Since we redirect, node.start() will fail: do manually. l1 = node_factory.get_node(options={'log-file': 'logfile'}, start=False) @@ -1554,6 +1555,16 @@ def test_logging(node_factory): return len(log2) > 0 and log2[0].endswith("Started log due to SIGHUP\n") wait_for(check_new_log) + # Issue #4240 + # Repeated SIGHUP should just re-open the log file + # and not terminate the daemon. + logpath_moved_2 = os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'logfile_moved_2') + shutil.move(logpath, logpath_moved_2) + l1.daemon.proc.send_signal(signal.SIGHUP) + wait_for(lambda: os.path.exists(logpath_moved_2)) + wait_for(lambda: os.path.exists(logpath)) + wait_for(check_new_log) + @unittest.skipIf(VALGRIND, "Valgrind sometimes fails assert on injected SEGV")