From 698eb0408f3550e6360dabf9a4fcbf3c54b83f2d Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Sat, 11 Feb 2023 12:03:56 +1030 Subject: [PATCH] pytest: adds xfail test that shows datastore issues When doing some plugin related work, I discovered that the datastore API has two issues: - Error messages on startup of plugins init method when the datastore is still completely empty: "Parsing '{datastore:[0:': token has no index 0: []" - Data is escaped but not unwrapped again when sending and getting from the API. [ Removed xfail, it now passes! --RR ] Closes: #5990 --- tests/test_misc.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_misc.py b/tests/test_misc.py index d144c66a8..bd9207708 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -2831,6 +2831,18 @@ def test_force_feerates(node_factory): "max_acceptable": 150000} +def test_datastore_escapeing(node_factory): + """ This test demonstrates that there is some character escaping issue + issue in the datastore API and error messages during startup that + affect plugins init method. """ + setdata = '{"foo": "bar"}' + l1 = node_factory.get_node() + l1.rpc.datastore(key='foo_bar', string=setdata) + getdata = l1.rpc.listdatastore('foo_bar')['datastore'][0]['string'] + assert not l1.daemon.is_in_log(r".*listdatastore error.*token has no index 0.*") + assert getdata == setdata + + def test_datastore(node_factory): l1 = node_factory.get_node()