Skip to content

Commit 0741d4d

Browse files
committed
pytest: fix flake in test_grpc_connect_notification
Looking at the logs (and comparing a successful run), it seems the connect happens before the connect_stream is ready, so we miss it: ``` ________________________ test_grpc_connect_notification ________________________ [gw7] linux -- Python 3.8.18 /home/runner/.cache/pypoetry/virtualenvs/cln-meta-project-AqJ9wMix-py3.8/bin/python node_factory = <pyln.testing.utils.NodeFactory object at 0x7fb08bb969d0> def test_grpc_connect_notification(node_factory): l1, l2 = node_factory.get_nodes(2) # Test the connect notification connect_stream = l1.grpc.SubscribeConnect(clnpb.StreamConnectRequest()) l2.connect(l1) > for connect_event in connect_stream: tests/test_cln_rs.py:425: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.cache/pypoetry/virtualenvs/cln-meta-project-AqJ9wMix-py3.8/lib/python3.8/site-packages/grpc/_channel.py:543: in __next__ return self._next() ../../../.cache/pypoetry/virtualenvs/cln-meta-project-AqJ9wMix-py3.8/lib/python3.8/site-packages/grpc/_channel.py:960: in _next _common.wait(self._state.condition.wait, _response_ready) ../../../.cache/pypoetry/virtualenvs/cln-meta-project-AqJ9wMix-py3.8/lib/python3.8/site-packages/grpc/_common.py:156: in wait _wait_once(wait_fn, MAXIMUM_WAIT_TIMEOUT, spin_cb) ../../../.cache/pypoetry/virtualenvs/cln-meta-project-AqJ9wMix-py3.8/lib/python3.8/site-packages/grpc/_common.py:116: in _wait_once wait_fn(timeout=timeout) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Condition(<unlocked _thread.RLock object owner=0 count=0 at 0x7fb089730f00>, 0)> timeout = 0.1 def wait(self, timeout=None): """Wait until notified or until a timeout occurs. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method releases the underlying lock, and then blocks until it is awakened by a notify() or notify_all() call for the same condition variable in another thread, or until the optional timeout occurs. Once awakened or timed out, it re-acquires the lock and returns. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). When the underlying lock is an RLock, it is not released using its release() method, since this may not actually unlock the lock when it was acquired multiple times recursively. Instead, an internal interface of the RLock class is used, which really unlocks it even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired. """ if not self._is_owned(): raise RuntimeError("cannot wait on un-acquired lock") waiter = _allocate_lock() waiter.acquire() self._waiters.append(waiter) saved_state = self._release_save() gotit = False try: # restore state no matter what (e.g., KeyboardInterrupt) if timeout is None: waiter.acquire() gotit = True else: if timeout > 0: > gotit = waiter.acquire(True, timeout) E Failed: Timeout >1200.0s ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent bd0b8e9 commit 0741d4d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_cln_rs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ def test_grpc_connect_notification(node_factory):
420420

421421
# Test the connect notification
422422
connect_stream = l1.grpc.SubscribeConnect(clnpb.StreamConnectRequest())
423+
424+
# FIXME: The above does not seem to be synchronous, causing a flake. Wait
425+
# until it does something (and this seems to be something!)
426+
l1.daemon.wait_for_log('plugin-cln-grpc: received settings ACK')
423427
l2.connect(l1)
424428

425429
for connect_event in connect_stream:

0 commit comments

Comments
 (0)