fix test
This commit is contained in:
parent
6d7b94fe1b
commit
55fb76f7f9
1 changed files with 11 additions and 5 deletions
|
@ -4,24 +4,30 @@ import lbry
|
||||||
import lbry.wallet
|
import lbry.wallet
|
||||||
from lbry.error import ServerPaymentFeeAboveMaxAllowedError
|
from lbry.error import ServerPaymentFeeAboveMaxAllowedError
|
||||||
from lbry.wallet.network import ClientSession
|
from lbry.wallet.network import ClientSession
|
||||||
from lbry.testcase import IntegrationTestCase, CommandTestCase
|
from lbry.testcase import CommandTestCase
|
||||||
from lbry.wallet.orchstr8.node import SPVNode
|
from lbry.wallet.orchstr8.node import SPVNode
|
||||||
|
|
||||||
|
|
||||||
class TestSessions(IntegrationTestCase):
|
class MockNetwork:
|
||||||
|
def __init__(self, ledger):
|
||||||
|
self.ledger = ledger
|
||||||
|
self._on_header_controller = None
|
||||||
|
|
||||||
|
|
||||||
|
class TestSessions(CommandTestCase):
|
||||||
"""
|
"""
|
||||||
Tests that server cleans up stale connections after session timeout and client times out too.
|
Tests that server cleans up stale connections after session timeout and client times out too.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LEDGER = lbry.wallet
|
|
||||||
|
|
||||||
async def test_session_bloat_from_socket_timeout(self):
|
async def test_session_bloat_from_socket_timeout(self):
|
||||||
await self.conductor.stop_spv()
|
await self.conductor.stop_spv()
|
||||||
await self.ledger.stop()
|
await self.ledger.stop()
|
||||||
self.conductor.spv_node.session_timeout = 1
|
self.conductor.spv_node.session_timeout = 1
|
||||||
await self.conductor.start_spv()
|
await self.conductor.start_spv()
|
||||||
|
|
||||||
session = ClientSession(
|
session = ClientSession(
|
||||||
network=None, server=(self.conductor.spv_node.hostname, self.conductor.spv_node.port), timeout=0.2
|
network=MockNetwork(self.ledger), server=(self.conductor.spv_node.hostname, self.conductor.spv_node.port),
|
||||||
|
timeout=0.2
|
||||||
)
|
)
|
||||||
await session.create_connection()
|
await session.create_connection()
|
||||||
await session.send_request('server.banner', ())
|
await session.send_request('server.banner', ())
|
||||||
|
|
Loading…
Add table
Reference in a new issue