Skip to content

Commit 2ade704

Browse files
committed
tests: added *non-developer mode* test for invalid filtering
1 parent 3ce90f8 commit 2ade704

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_misc.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5042,3 +5042,27 @@ def test_zero_locktime_blocks(node_factory, bitcoind):
50425042
l2.rpc.close(l3.info['id'])
50435043
bitcoind.generate_block(1, wait_for_mempool=2)
50445044
sync_blockheight(bitcoind, [l1, l2, l3])
5045+
5046+
5047+
def test_filter_with_invalid_json(node_factory):
5048+
# This crashes only in *non-developer mode*: it uses command_log()
5049+
# in that case (since it doesn't print the invalid token in
5050+
# non-dev mode), and that expects cmd->json_cmd to be populated!`
5051+
l1 = node_factory.get_node(start=False)
5052+
l1.daemon.early_opts = []
5053+
l1.daemon.opts = {k: v for k, v in l1.daemon.opts.items() if not k.startswith('dev')}
5054+
l1.start()
5055+
5056+
out = subprocess.run(['cli/lightning-cli',
5057+
'--network={}'.format(TEST_NETWORK),
5058+
'--lightning-dir={}'
5059+
.format(l1.daemon.lightning_dir),
5060+
'-l', '1',
5061+
'-k',
5062+
'wait',
5063+
'subsystem=invoices',
5064+
'indexname=created',
5065+
'nextvalue=0'],
5066+
stdout=subprocess.PIPE)
5067+
assert 'filter: Expected object: invalid token' in out.stdout.decode('utf-8')
5068+
assert out.returncode == 1

0 commit comments

Comments
 (0)