Browse Source

tests: fix TestLNTransport probabilistic failure

lucky CI run: https://github.com/spesmilo/electrum/runs/9273471816
patch-4
SomberNight 2 years ago
parent
commit
84faf7f99a
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 9
      electrum/tests/test_lntransport.py

9
electrum/tests/test_lntransport.py

@ -77,8 +77,8 @@ class TestLNTransport(ElectrumTestCase):
await group.spawn(read_messages(t, messages_sent_by_client))
await group.spawn(write_messages(t, messages_sent_by_server))
responder_shaked.set()
async def connect():
peer_addr = LNPeerAddr('127.0.0.1', 42898, responder_key.get_public_key_bytes())
async def connect(port: int):
peer_addr = LNPeerAddr('127.0.0.1', port, responder_key.get_public_key_bytes())
t = LNTransport(initiator_key.get_secret_bytes(), peer_addr, proxy=None)
await t.handshake()
async with OldTaskGroup() as group:
@ -87,10 +87,11 @@ class TestLNTransport(ElectrumTestCase):
server_shaked.set()
async def f():
server = await asyncio.start_server(cb, '127.0.0.1', 42898)
server = await asyncio.start_server(cb, '127.0.0.1', port=None)
server_port = server.sockets[0].getsockname()[1]
try:
async with OldTaskGroup() as group:
await group.spawn(connect())
await group.spawn(connect(port=server_port))
await group.spawn(responder_shaked.wait())
await group.spawn(server_shaked.wait())
finally:

Loading…
Cancel
Save