Skip to content

CI flake test_websocket_no_rune #9561

Description

@daywalker90
____________________________ test_websocket_no_rune ____________________________
[gw1] linux -- Python 3.10.21 /home/runner/work/lightning/lightning/.venv/bin/python

l1 = <fixtures.LightningNode object at 0x7f5e04f60280>
base_url = 'https://127.0.0.1:11039/'
http_session = <requests.sessions.Session object at 0x7f5e06be9c00>
rpc_method = 'invoice', rpc_params = [100000, 'label', 'description']
expect_error = 'Missing rune'

    def notifications_received_via_websocket(l1, base_url, http_session, rpc_method='invoice', rpc_params=[100000, 'label', 'description'], expect_error=None):
        """Return the list of notifications received by the websocket client.
    
        We try to connect to the websocket server running at `base_url`
        with `http_session` parameters.  Then we create an invoice on the node:
    
        - if we were effectively connected, we received an `invoice_creation`
          notification via websocket that should be in the list of notifications
          we return.
        - if we couldn't connect to the websocket server, the notification list
          we return is empty."""
        http_session.headers.update({"upgrade": "websocket"})
        sio = socketio.Client(http_session=http_session)
        notifications = []
        connection_error_msg = None
    
        @sio.event
        def message(data):
            notifications.append(data)
    
        @sio.event
        def connect_error(data):
            nonlocal connection_error_msg
            connection_error_msg = str(data)
    
        try:
>           sio.connect(base_url)

tests/test_clnrest.py:294: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <socketio.client.Client object at 0x7f5e06be8850>
url = 'https://127.0.0.1:11039/', headers = {}, auth = None, transports = None
namespaces = ['/'], socketio_path = 'socket.io', wait = True, wait_timeout = 1
retry = False

    def connect(self, url, headers={}, auth=None, transports=None,
                namespaces=None, socketio_path='socket.io', wait=True,
                wait_timeout=1, retry=False):
        """Connect to a Socket.IO server.
    
        :param url: The URL of the Socket.IO server. It can include custom
                    query string parameters if required by the server. If a
                    function is provided, the client will invoke it to obtain
                    the URL each time a connection or reconnection is
                    attempted.
        :param headers: A dictionary with custom headers to send with the
                        connection request. If a function is provided, the
                        client will invoke it to obtain the headers dictionary
                        each time a connection or reconnection is attempted.
        :param auth: Authentication data passed to the server with the
                     connection request, normally a dictionary with one or
                     more string key/value pairs. If a function is provided,
                     the client will invoke it to obtain the authentication
                     data each time a connection or reconnection is attempted.
        :param transports: The list of allowed transports. Valid transports
                           are ``'polling'`` and ``'websocket'``. If not
                           given, the polling transport is connected first,
                           then an upgrade to websocket is attempted.
        :param namespaces: The namespaces to connect as a string or list of
                           strings. If not given, the namespaces that have
                           registered event handlers are connected.
        :param socketio_path: The endpoint where the Socket.IO server is
                              installed. The default value is appropriate for
                              most cases.
        :param wait: if set to ``True`` (the default) the call only returns
                     when all the namespaces are connected. If set to
                     ``False``, the call returns as soon as the Engine.IO
                     transport is connected, and the namespaces will connect
                     in the background.
        :param wait_timeout: How long the client should wait for the
                             connection. The default is 1 second. This
                             argument is only considered when ``wait`` is set
                             to ``True``.
        :param retry: Apply the reconnection logic if the initial connection
                      attempt fails. The default is ``False``.
    
        Example usage::
    
            sio = socketio.Client()
            sio.connect('http://localhost:5000')
        """
        if self.connected:
            raise exceptions.ConnectionError('Already connected')
    
        self.connection_url = url
        self.connection_headers = headers
        self.connection_auth = auth
        self.connection_transports = transports
        self.connection_namespaces = namespaces
        self.socketio_path = socketio_path
    
        if namespaces is None:
            namespaces = list(set(self.handlers.keys()).union(
                set(self.namespace_handlers.keys())))
            if '*' in namespaces:
                namespaces.remove('*')
            if len(namespaces) == 0:
                namespaces = ['/']
        elif isinstance(namespaces, str):
            namespaces = [namespaces]
        self.connection_namespaces = namespaces
        self.namespaces = {}
        self.failed_namespaces = []
        if self._connect_event is None:
            self._connect_event = self.eio.create_event()
        else:
            self._connect_event.clear()
        real_url = self._get_real_value(self.connection_url)
        real_headers = self._get_real_value(self.connection_headers)
        try:
            self.eio.connect(real_url, headers=real_headers,
                             transports=transports,
                             engineio_path=socketio_path)
        except engineio.exceptions.ConnectionError as exc:
            for n in self.connection_namespaces:
                self._trigger_event(
                    'connect_error', n,
                    exc.args[1] if len(exc.args) > 1 else exc.args[0])
            if retry:  # pragma: no cover
                self._handle_reconnect()
                if self.eio.state == 'connected':
                    return
            raise exceptions.ConnectionError(exc.args[0]) from exc
    
        if wait:
            while self._connect_event.wait(timeout=wait_timeout):
                self._connect_event.clear()
                if len(self.namespaces) + len(self.failed_namespaces) == \
                        len(self.connection_namespaces):
                    break
            if set(self.namespaces) != set(self.connection_namespaces):
                self.disconnect()
>               raise exceptions.ConnectionError(
                    'One or more namespaces failed to connect: '
                    + ', '.join(self.failed_namespaces))
E               socketio.exceptions.ConnectionError: One or more namespaces failed to connect:

.venv/lib/python3.10/site-packages/socketio/client.py:171: ConnectionError

During handling of the above exception, another exception occurred:

node_factory = <pyln.testing.utils.NodeFactory object at 0x7f5e04aaaf80>

    def test_websocket_no_rune(node_factory):
        """Test websocket with default values for options."""
        # start a node with clnrest
        l1, base_url, ca_cert = start_node_with_clnrest(node_factory)
    
        # http session
        http_session = http_session_with_retry()
        http_session.verify = ca_cert.as_posix()
    
        # no rune provided => no websocket connection and no notification received
>       notifications = notifications_received_via_websocket(l1, base_url, http_session, expect_error="Missing rune")

tests/test_clnrest.py:326: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

l1 = <fixtures.LightningNode object at 0x7f5e04f60280>
base_url = 'https://127.0.0.1:11039/'
http_session = <requests.sessions.Session object at 0x7f5e06be9c00>
rpc_method = 'invoice', rpc_params = [100000, 'label', 'description']
expect_error = 'Missing rune'

    def notifications_received_via_websocket(l1, base_url, http_session, rpc_method='invoice', rpc_params=[100000, 'label', 'description'], expect_error=None):
        """Return the list of notifications received by the websocket client.
    
        We try to connect to the websocket server running at `base_url`
        with `http_session` parameters.  Then we create an invoice on the node:
    
        - if we were effectively connected, we received an `invoice_creation`
          notification via websocket that should be in the list of notifications
          we return.
        - if we couldn't connect to the websocket server, the notification list
          we return is empty."""
        http_session.headers.update({"upgrade": "websocket"})
        sio = socketio.Client(http_session=http_session)
        notifications = []
        connection_error_msg = None
    
        @sio.event
        def message(data):
            notifications.append(data)
    
        @sio.event
        def connect_error(data):
            nonlocal connection_error_msg
            connection_error_msg = str(data)
    
        try:
            sio.connect(base_url)
        except socketio.exceptions.ConnectionError as e:
            # Use the detailed error message if available
            error_str = connection_error_msg if connection_error_msg else str(e)
    
            if expect_error and expect_error in error_str:
                return notifications
            else:
>               raise ValueError(f"Expected error code `{expect_error}`, got `{error_str}` instead")
E               ValueError: Expected error code `Missing rune`, got `One or more namespaces failed to connect: ` instead

tests/test_clnrest.py:302: ValueError
lightningd-1 2026-09-24T13:22:06.622Z DEBUG   connectd: Created listener on 127.0.0.1:6424
lightningd-1 2026-09-24T13:22:06.622Z DEBUG   connectd: REPLY WIRE_CONNECTD_INIT_REPLY with 0 fds
lightningd-1 2026-09-24T13:22:06.622Z DEBUG   lightningd: io_break: connect_init_done
lightningd-1 2026-09-24T13:22:06.622Z DEBUG   lightningd: io_loop: connectd_init
lightningd-1 2026-09-24T13:22:06.642Z INFO    plugin-bcli: bitcoin-cli initialized and connected to bitcoind.
lightningd-1 2026-09-24T13:22:06.642Z DEBUG   lightningd: io_break: plugin_config_cb
lightningd-1 2026-09-24T13:22:06.642Z DEBUG   lightningd: io_loop_with_timers: config_plugin
lightningd-1 2026-09-24T13:22:06.642Z DEBUG   lightningd: All Bitcoin plugin commands registered
lightningd-1 2026-09-24T13:22:06.740Z DEBUG   lightningd: Adding block 100: 6872fc29a53f23e86a5231f791d948968b1a272038b9dc408d60d639c0b11c73
lightningd-1 2026-09-24T13:22:06.742Z DEBUG   lightningd: Got 0 unconfirmed transactions
lightningd-1 2026-09-24T13:22:06.743Z DEBUG   wallet: Loaded 0 channels from DB
lightningd-1 2026-09-24T13:22:06.746Z DEBUG   gossipd: pid 59231, msgfd 75
lightningd-1 2026-09-24T13:22:06.753Z DEBUG   gossipd: gossip_store: 0 live records, 0 deleted
lightningd-1 2026-09-24T13:22:06.753Z DEBUG   gossipd: seeker: state = STARTING_UP New seeker
lightningd-1 2026-09-24T13:22:06.753Z DEBUG   gossipd: REPLY WIRE_GOSSIPD_INIT_REPLY with 0 fds
lightningd-1 2026-09-24T13:22:06.753Z DEBUG   lightningd: io_break: gossipd_init_done
lightningd-1 2026-09-24T13:22:06.753Z DEBUG   lightningd: io_loop: gossip_init
lightningd-1 2026-09-24T13:22:06.758Z DEBUG   plugin-cln-lsps-client: Killing plugin: disabled itself at init: `experimental-lsps-client` not enabled
lightningd-1 2026-09-24T13:22:06.759Z DEBUG   plugin-wss-proxy: Killing plugin: disabled itself at init: `wss-bind-addr` option is not configured
lightningd-1 2026-09-24T13:22:06.760Z DEBUG   plugin-clnrest: Background task spawned
lightningd-1 2026-09-24T13:22:06.760Z DEBUG   plugin-cln-lsps-service: Killing plugin: disabled itself at init: `experimental-lsps2-service` not enabled
lightningd-1 2026-09-24T13:22:06.760Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:06.765Z DEBUG   plugin-cln-grpc: Generating a new keypair in /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/ca-key.pem, it didn't exist
lightningd-1 2026-09-24T13:22:06.766Z DEBUG   plugin-cln-grpc: Generating a new certificate for key /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/ca-key.pem at /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/ca.pem
lightningd-1 2026-09-24T13:22:06.766Z DEBUG   plugin-cln-grpc: Generating a new keypair in /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/server-key.pem, it didn't exist
lightningd-1 2026-09-24T13:22:06.766Z DEBUG   plugin-cln-grpc: Generating a new certificate for key /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/server-key.pem at /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/server.pem
lightningd-1 2026-09-24T13:22:06.766Z DEBUG   plugin-cln-grpc: Generating a new keypair in /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/client-key.pem, it didn't exist
lightningd-1 2026-09-24T13:22:06.766Z DEBUG   plugin-cln-grpc: Generating a new certificate for key /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/client-key.pem at /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/regtest/client.pem
lightningd-1 2026-09-24T13:22:06.766Z DEBUG   plugin-cln-grpc: add_parsable_certificates processed 1 valid and 0 invalid certs
lightningd-1 2026-09-24T13:22:06.766Z INFO    plugin-cln-grpc: Connecting to "lightning-rpc" and serving grpc on 127.0.0.1:26075
lightningd-1 2026-09-24T13:22:06.801Z DEBUG   hsmd: Client: Received message 27 from client
lightningd-1 2026-09-24T13:22:06.808Z DEBUG   plugin-recklessrpc: plugin initialized!
lightningd-1 2026-09-24T13:22:06.808Z DEBUG   plugin-recklessrpc: lightning-dir: /tmp/ltests-j0rh__6d/test_websocket_no_rune_1/lightning-1/
lightningd-1 2026-09-24T13:22:06.808Z DEBUG   plugin-recover: Recover Plugin Initialised!
lightningd-1 2026-09-24T13:22:06.808Z DEBUG   plugin-recover: Gossmap loaded!
lightningd-1 2026-09-24T13:22:06.811Z DEBUG   plugin-chanbackup: Chanbackup Initialised!
lightningd-1 2026-09-24T13:22:06.811Z INFO    plugin-chanbackup: Creating Emergency Recovery
lightningd-1 2026-09-24T13:22:06.812Z TRACE   plugin-cln-askrene: json_askrene_create_layer called: {"layer":"xpay","persistent":true}
lightningd-1 2026-09-24T13:22:06.821Z DEBUG   plugin-bookkeeper: JSON reply with unknown id '{"jsonrpc":"2.0","id":"cln:init#56/bookkeeper:datastore#6","result":{"key":["bookkeeper","account","wallet"],"generation":0,"hex":"77616c6c6574000000000000000000000000000000000000"}}'
lightningd-1 2026-09-24T13:22:06.838Z DEBUG   hsmd: Client: Received message 27 from client
lightningd-1 2026-09-24T13:22:06.839Z DEBUG   hsmd: Client: Received message 27 from client
lightningd-1 2026-09-24T13:22:06.839Z DEBUG   hsmd: Client: Received message 27 from client
lightningd-1 2026-09-24T13:22:06.840Z DEBUG   connectd: REPLY WIRE_CONNECTD_ACTIVATE_REPLY with 0 fds
lightningd-1 2026-09-24T13:22:06.840Z DEBUG   lightningd: io_break: connect_activate_done
lightningd-1 2026-09-24T13:22:06.840Z DEBUG   lightningd: io_loop: connectd_activate
lightningd-1 2026-09-24T13:22:06.841Z INFO    lightningd: --------------------------------------------------
lightningd-1 2026-09-24T13:22:06.841Z INFO    lightningd: Server started with public key 038194b5f32bdf0aa59812c86c4ef7ad2f294104fa027d1ace9b469bb6f88cf37b, alias STRANGEBOUNCE- (color #038194) and lightningd 
lightningd-1 2026-09-24T13:22:06.909Z DEBUG   lightningd: Adding block 101: 62100c56fb1f8f899dbf1d550a8591fed3163a2a09da332bbf20265af2128f06
lightningd-1 2026-09-24T13:22:06.922Z DEBUG   gossipd: REPLY WIRE_GOSSIPD_NEW_BLOCKHEIGHT_REPLY with 0 fds
lightningd-1 2026-09-24T13:22:07.259Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:07.971Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:08.383Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:08.908Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:09.442Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:09.960Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:10.430Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:10.947Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:11.439Z DEBUG   plugin-clnrest: Certificates incomplete. Retrying...
lightningd-1 2026-09-24T13:22:11.758Z DEBUG   gossipd: seeker: no peers, waiting
lightningd-1 2026-09-24T13:22:11.949Z DEBUG   plugin-clnrest: Certificates still not existing after retries. Generating...
lightningd-1 2026-09-24T13:22:11.949Z DEBUG   plugin-clnrest: Certificates generated.
lightningd-1 2026-09-24T13:22:11.949Z INFO    plugin-clnrest: REST server running at https://127.0.0.1:11039/
lightningd-1 2026-09-24T13:22:12.271Z INFO    plugin-clnrest: verify_rune failed: method: `listclnrest-notifications` Error code 1501: Not authorized: Missing rune
{'run_id': 361501080009830400, 'github_repository': 'ElementsProject/lightning', 'github_sha': '08b5dc302b917de1ee705a534979605a3687a2b6', 'github_ref': 'refs/pull/9555/merge', 'github_ref_name': 'HEAD', 'github_run_id': 36003177273, 'github_head_ref': 'fix-test_payment_duplicate_uncommitted', 'github_run_number': 17987, 'github_base_ref': 'master', 'github_run_attempt': '1', 'testname': 'test_websocket_no_rune', 'start_time': 1790256125, 'end_time': 1790256133, 'outcome': 'fail'}

https://github.com/ElementsProject/lightning/actions/runs/36003177273/job/107648376140?pr=9555

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions