Skip to content

Commit

Permalink
tests/test_misc.py: Add a test for issue #4240.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZmnSCPxj authored and rustyrussell committed Dec 2, 2020
1 parent 4185a86 commit 67d8fdc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -1554,6 +1555,16 @@ def check_new_log():
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")
Expand Down

0 comments on commit 67d8fdc

Please sign in to comment.