Skip to content

Commit

Permalink
pytest: test sql deprecated field (now we have one!).
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and endothermicdev committed Feb 19, 2025
1 parent bcc61ce commit e69ecbd
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4250,16 +4250,19 @@ def test_sql(node_factory, bitcoind):


def test_sql_deprecated(node_factory, bitcoind):
# deprecated-apis breaks schemas...
l1 = node_factory.get_node(start=False, options={'allow-deprecated-apis': True})
l1.rpc.check_request_schemas = False
l1.start()
l1, l2 = node_factory.line_graph(2, opts=[{'allow-deprecated-apis': True}, {}])

# l1 allows it, l2 doesn't
ret = l1.rpc.sql("SELECT max_total_htlc_in_msat FROM peerchannels;")
assert ret == {'rows': [[-1]]}

# FIXME: we have no fields which have been deprecated since sql plugin was
# introduced. When we do, add them here! (I manually tested a fake one)
# It's deprecated in l2, so that will fail!
with pytest.raises(RpcError, match="Deprecated column table peerchannels.max_total_htlc_in_msat"):
l2.rpc.sql("SELECT max_total_htlc_in_msat FROM peerchannels;")

# ret = l1.rpc.sql("SELECT funding_local_msat, funding_remote_msat FROM peerchannels;")
# assert ret == {'rows': []}
# But we can use a wildcard fine.
ret = l2.rpc.sql("SELECT COUNT(*) FROM peerchannels;")
assert ret == {'rows': [[1]]}


def test_plugin_persist_option(node_factory):
Expand Down

0 comments on commit e69ecbd

Please sign in to comment.