fix hanging test

This commit is contained in:
Victor Shyba 2020-01-12 00:48:46 -03:00
parent 5a6218eeca
commit ffa5c20c88
3 changed files with 12 additions and 6 deletions

View file

@ -173,6 +173,9 @@ class SPVNode:
async def start(self, blockchain_node: 'BlockchainNode', extraconf=None): async def start(self, blockchain_node: 'BlockchainNode', extraconf=None):
self.data_path = tempfile.mkdtemp() self.data_path = tempfile.mkdtemp()
conf = { conf = {
'DESCRIPTION': '',
'PAYMENT_ADDRESS': '',
'DAILY_FEE': '0',
'DB_DIRECTORY': self.data_path, 'DB_DIRECTORY': self.data_path,
'DAEMON_URL': blockchain_node.rpc_url, 'DAEMON_URL': blockchain_node.rpc_url,
'REORG_LIMIT': '100', 'REORG_LIMIT': '100',

View file

@ -1,5 +1,4 @@
import logging import logging
import os
import asyncio import asyncio
import lbry import lbry
@ -33,11 +32,14 @@ class NetworkTests(IntegrationTestCase):
'server_version': lbry.__version__}, await self.ledger.network.get_server_features()) 'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
await self.conductor.spv_node.stop() await self.conductor.spv_node.stop()
address = (await self.account.get_addresses(limit=1))[0] address = (await self.account.get_addresses(limit=1))[0]
os.environ.update({ await self.conductor.spv_node.start(
'DESCRIPTION': 'Fastest server in the west.', self.conductor.blockchain_node,
'PAYMENT_ADDRESS': address, extraconf={
'DAILY_FEE': '42'}) 'DESCRIPTION': 'Fastest server in the west.',
await self.conductor.spv_node.start(self.conductor.blockchain_node) 'PAYMENT_ADDRESS': address,
'DAILY_FEE': '42'
}
)
await self.ledger.network.on_connected.first await self.ledger.network.on_connected.first
self.assertDictEqual({ self.assertDictEqual({
'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH, 'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH,

View file

@ -69,6 +69,7 @@ class TestUsagePayment(CommandTestCase):
node = SPVNode(self.conductor.spv_module, node_number=2) node = SPVNode(self.conductor.spv_module, node_number=2)
await node.start(self.blockchain, extraconf={"PAYMENT_ADDRESS": address, "DAILY_FEE": "1.1"}) await node.start(self.blockchain, extraconf={"PAYMENT_ADDRESS": address, "DAILY_FEE": "1.1"})
self.addCleanup(node.stop)
self.daemon.jsonrpc_settings_set('lbryum_servers', [f"{node.hostname}:{node.port}"]) self.daemon.jsonrpc_settings_set('lbryum_servers', [f"{node.hostname}:{node.port}"])
await self.daemon.jsonrpc_wallet_reconnect() await self.daemon.jsonrpc_wallet_reconnect()