Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyln-client: pass through level parameter on command notifications. #7287

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/pyln-client/pyln/client/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def log(self, message: str, level: str = 'info') -> None:
def notify_message(self, request: Request, message: str,
level: str = 'info') -> None:
"""Send a notification message to sender of this request"""
request.notify(message=message)
request.notify(message=message, level=level)

def notify_progress(self, request: Request,
progress: int, progress_total: int,
Expand Down
17 changes: 8 additions & 9 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,6 @@ def test_htlc_accepted_hook_crash(node_factory, executor):
f.result(10)


@pytest.mark.skip("With newer GCC versions reports a '*** buffer overflow detected ***: terminated'")
def test_notify(node_factory):
"""Test that notifications from plugins get ignored"""
plugins = [os.path.join(os.getcwd(), 'tests/plugins/notify.py'),
Expand All @@ -2292,17 +2291,17 @@ def test_notify(node_factory):
else:
assert out[2 + i].endswith("|\r")

assert out[102] == '# Beginning stage 2\n'
assert out[103] == '\r'

# These messages are DEBUG level, and default is INFO, so there is no
# "'# Beginning stage 2\n'
assert out[102] == '\r'
for i in range(10):
assert out[104 + i].startswith("# Stage 2/2 {:>2}/10 |".format(1 + i))
assert out[103 + i].startswith("# Stage 2/2 {:>2}/10 |".format(1 + i))
if i == 9:
assert out[104 + i].endswith("|\n")
assert out[103 + i].endswith("|\n")
else:
assert out[104 + i].endswith("|\r")
assert out[114] == '"This worked"\n'
assert len(out) == 115
assert out[103 + i].endswith("|\r")
assert out[113] == '"This worked"\n'
assert len(out) == 114

# At debug level, we get the second prompt.
out = subprocess.check_output(['cli/lightning-cli',
Expand Down
Loading