pytest: fix flake in test_custommsg_triggers_notification

If listpeers on l2 is called too fast, then it won't return any peers, and
we will fail:

```
        # Connect l1 to l2
        l1.connect(l2)
>       wait_for(lambda: l2.rpc.listpeers(l1.info['id'])['peers'][0]['connected'])

tests/test_misc.py:2690:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
contrib/pyln-testing/pyln/testing/utils.py:88: in wait_for
    while not success():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   wait_for(lambda: l2.rpc.listpeers(l1.info['id'])['peers'][0]['connected'])
E   IndexError: list index out of range
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-01-29 10:11:39 +10:30
parent 6778f320d2
commit bf9cdc597e

View file

@ -2687,7 +2687,7 @@ def test_custommsg_triggers_notification(node_factory):
# Connect l1 to l2
l1.connect(l2)
wait_for(lambda: l2.rpc.listpeers(l1.info['id'])['peers'][0]['connected'])
wait_for(lambda: [p['connected'] for p in l2.rpc.listpeers(l1.info['id'])['peers']] == [True])
# Send a custommsg from l2 to l1
# The message id 7777 is chosen to be sufficiently high and shouldn't be used by the