Skip to content

Commit

Permalink
pytest: fix flake in test_remote_addr_port
Browse files Browse the repository at this point in the history
```
FAILED tests/test_connection.py::test_remote_addr_port - TimeoutError: Unable to find "[re.compile('Update our node_announcement for discovered address')]" in logs.
```

Because it can happen before the "Already have funding locked in" message:

```
lightningd-2 2023-10-24T22:07:02.018Z DEBUG   gossipd: Update our node_announcement for discovered address: 127.0.0.1:1234
lightningd-2 2023-10-24T22:07:02.019Z DEBUG   lightningd: Plugin chanbackup returned from peer_connected hook call
lightningd-2 2023-10-24T22:07:02.019Z DEBUG   035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d-chan#2: Peer has reconnected, state CHANNELD_NORMAL: connecting subd
lightningd-2 2023-10-24T22:07:02.036Z DEBUG   035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d-channeld-chan#2: pid 63142, msgfd 67
lightningd-2 2023-10-24T22:07:02.037Z DEBUG   035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d-chan#2: Already have funding locked in (and ready to announce)
```

Also, wait_for_log() asserts itself, no need to assert on result.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and vincenzopalazzo committed Oct 25, 2023
1 parent 39e17ff commit 0550bb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ def test_remote_addr_port(node_factory, bitcoind):
l2.daemon.wait_for_log("Already have funding locked in")
l3.restart()
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
l2.daemon.wait_for_log("Already have funding locked in")

# if ip discovery would have been enabled, we would have send an updated
# node_annoucement by now. Check we didn't...
assert l2.daemon.wait_for_log("Update our node_announcement for discovered address")
l2.daemon.wait_for_logs(["Already have funding locked in",
"Update our node_announcement for discovered address"])
info = l2.rpc.getinfo()
assert len(info['address']) == 1
assert info['address'][0]['type'] == 'ipv4'
Expand Down

0 comments on commit 0550bb0

Please sign in to comment.