Skip to content
Draft
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
35 changes: 35 additions & 0 deletions tests/test_reckless.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ def test_basic_help():
assert r.search_stdout("options:") or r.search_stdout("optional arguments:")


def test_version():
'''Version should be reported without loading config and should advance
with lightningd'''
r = reckless(["-V", "-v", "--json"])
assert r.returncode == 0
import json
json_out = ''.join(r.stdout)
with open('.version', 'r') as f:
version = f.readlines()[0].strip()
assert json.loads(json_out)['result'][0] == version


def test_contextual_help(node_factory):
n = get_reckless_node(node_factory)
for subcmd in ['install', 'uninstall', 'search',
Expand Down Expand Up @@ -238,6 +250,18 @@ def test_install(node_factory):
assert os.path.exists(plugin_path)


def test_install_cleanup(node_factory):
"""test failed installation and post install cleanup"""
n = get_reckless_node(node_factory)
n.start()
r = reckless([f"--network={NETWORK}", "-v", "install", "testplugfail"], dir=n.lightning_dir)
assert r.returncode == 0
assert r.search_stdout('testplugfail failed to start')
r.check_stderr()
plugin_path = Path(n.lightning_dir) / 'reckless/testplugfail'
assert not os.path.exists(plugin_path)


@unittest.skipIf(VALGRIND, "virtual environment triggers memleak detection")
def test_poetry_install(node_factory):
"""test search, git clone, and installation to folder."""
Expand Down Expand Up @@ -366,3 +390,14 @@ def test_reckless_uv_install(node_factory):

assert r.search_stdout('using installer pythonuv')
r.check_stderr()

def test_reckless_available(node_factory):
"""list available plugins"""
n = get_reckless_node(node_factory)
r = reckless([f"--network={NETWORK}", "available", "-v", "--json"], dir=n.lightning_dir)
assert r.returncode == 0
# All plugins in the default repo should be found and identified as installable.
assert r.search_stdout('testplugfail')
assert r.search_stdout('testplugpass')
assert r.search_stdout('testplugpyproj')
assert r.search_stdout('testpluguv')
Loading
Loading