pytest: Add a test for the grpc plugin

Currently still unencrypted, but will get its mTLS authentication in
the next commits.
This commit is contained in:
Christian Decker 2022-01-18 10:44:20 +01:00 committed by Rusty Russell
parent a17edeb839
commit d221c9b491

View File

@ -1,9 +1,11 @@
from fixtures import * # noqa: F401,F403
from node_pb2_grpc import NodeStub
from pathlib import Path
from pyln.testing.utils import env, TEST_NETWORK
import subprocess
import grpc
import node_pb2 as nodepb
import pytest
import subprocess
# Skip the entire module if we don't have Rust.
pytestmark = pytest.mark.skipif(
@ -27,6 +29,10 @@ def test_plugin_start(node_factory):
l1 = node_factory.get_node(options={"plugin": str(bin_path), 'test-option': 31337})
l2 = node_factory.get_node()
# The plugin should be in the list of active plugins
plugins = l1.rpc.plugin('list')['plugins']
assert len([p for p in plugins if 'cln-plugin-startup' in p['name'] and p['active']]) == 1
cfg = l1.rpc.listconfigs()
p = cfg['plugins'][0]
p['path'] = None # The path is host-specific, so blank it.