MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_warning_notification

Function test_warning_notification

tests/test_plugin.py:1492–1529  ·  view source on GitHub ↗

test 'warning' notifications

(node_factory)

Source from the content-addressed store, hash-verified

1490
1491
1492def test_warning_notification(node_factory):
1493 """ test 'warning' notifications
1494 """
1495 l1 = node_factory.get_node(options={'plugin': os.path.join(os.getcwd(), 'tests/plugins/pretend_badlog.py')}, broken_log=r'Test warning notification\(for broken event\)|LINE[12]')
1496
1497 # 1. test 'warn' level
1498 event = "Test warning notification(for unusual event)"
1499 l1.rpc.call('pretendbad', {'event': event, 'level': 'warn'})
1500
1501 # ensure an unusual log_entry was produced by 'pretendunusual' method
1502 l1.daemon.wait_for_log('plugin-pretend_badlog.py: Test warning notification\\(for unusual event\\)')
1503
1504 # now wait for notification
1505 l1.daemon.wait_for_log('plugin-pretend_badlog.py: Received warning')
1506 l1.daemon.wait_for_log('plugin-pretend_badlog.py: level: warn')
1507 l1.daemon.wait_for_log('plugin-pretend_badlog.py: time: *')
1508 l1.daemon.wait_for_log('plugin-pretend_badlog.py: source: plugin-pretend_badlog.py')
1509 l1.daemon.wait_for_log('plugin-pretend_badlog.py: log: Test warning notification\\(for unusual event\\)')
1510
1511 # 2. test 'error' level, steps like above
1512 event = "Test warning notification(for broken event)"
1513 l1.rpc.call('pretendbad', {'event': event, 'level': 'error'})
1514 l1.daemon.wait_for_log(r'\*\*BROKEN\*\* plugin-pretend_badlog.py: Test warning notification\(for broken event\)')
1515
1516 l1.daemon.wait_for_log('plugin-pretend_badlog.py: Received warning')
1517 l1.daemon.wait_for_log('plugin-pretend_badlog.py: level: error')
1518 l1.daemon.wait_for_log('plugin-pretend_badlog.py: time: *')
1519 l1.daemon.wait_for_log('plugin-pretend_badlog.py: source: plugin-pretend_badlog.py')
1520 l1.daemon.wait_for_log('plugin-pretend_badlog.py: log: Test warning notification\\(for broken event\\)')
1521
1522 # Test linesplitting while we're here
1523 l1.rpc.call('pretendbad', {'event': 'LINE1\nLINE2', 'level': 'error'})
1524 l1.daemon.wait_for_log(r'\*\*BROKEN\*\* plugin-pretend_badlog.py: LINE1')
1525 l1.daemon.wait_for_log(r'\*\*BROKEN\*\* plugin-pretend_badlog.py: LINE2')
1526 l1.daemon.wait_for_log('plugin-pretend_badlog.py: Received warning')
1527 l1.daemon.wait_for_log('plugin-pretend_badlog.py: log: LINE1')
1528 l1.daemon.wait_for_log('plugin-pretend_badlog.py: Received warning')
1529 l1.daemon.wait_for_log('plugin-pretend_badlog.py: log: LINE2')
1530
1531
1532def test_invoice_payment_notification(node_factory):

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected