Skip to content

Commit

Permalink
pytest: fix flake in test_offer_paths
Browse files Browse the repository at this point in the history
Gossipd can mess this test up by spontaneously opening connections!

```
        # This will make us connect straight to l3 to use blinded path from there.
        l5.rpc.disconnect(l4.info['id'])
        l5.rpc.fetchinvoice(offer=offer['bolt12'])
>       assert l5.daemon.is_in_log('connecting')
E       AssertionError: assert None
E        +  where None = <bound method TailableProc.is_in_log of <pyln.testing.utils.LightningD object at 0x7fc01cf38dc0>>('connecting')
E        +    where <bound method TailableProc.is_in_log of <pyln.testing.utils.LightningD object at 0x7fc01cf38dc0>> = <pyln.testing.utils.LightningD object at 0x7fc01cf38dc0>.is_in_log
E        +      where <pyln.testing.utils.LightningD object at 0x7fc01cf38dc0> = <fixtures.LightningNode object at 0x7fc01cf1e200>.daemon

tests/test_pay.py:5733: AssertionError
```

You can see in the logs:

```
lightningd-5 2024-11-22T06:10:16.350Z DEBUG   plugin-offers: Found path to 035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d: 032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e(us)
lightningd-5 2024-11-22T06:10:16.352Z DEBUG   plugin-offers: -> 035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d
```

How did it find a path to l3?

```
lightningd-5 2024-11-22T06:10:10.609Z DEBUG   gossipd: seeker: need more peers for gossip (have 1)
lightningd-5 2024-11-22T06:10:10.611Z DEBUG   lightningd: attempting connection to 035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d for additional gossip
```

If we see more flakes like this, we might want to set autoconnect-seeker-peers to 0
by default in pyln-testing.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Nov 22, 2024
1 parent ce0ac5d commit 030b46c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -5707,7 +5707,10 @@ def test_offer_paths(node_factory, bitcoind):
assert paths[0]['first_scid_dir'] == chan['direction']
assert paths[1]['first_node_id'] == l3.info['id']

l5 = node_factory.get_node(options=opts)
# We want to force l5 to connect manually, so don't have gossipd
# connect for itself!
l5 = node_factory.get_node(options={'dev-allow-localhost': None,
'autoconnect-seeker-peers': 0})

# Get all the gossip, so we have addresses
l5.rpc.connect(l1.info['id'], 'localhost', l1.port)
Expand Down

0 comments on commit 030b46c

Please sign in to comment.