run CI for old and new setups

This commit is contained in:
Victor Shyba 2021-09-01 03:37:57 -03:00 committed by Victor Shyba
parent d713783736
commit 8206441834
6 changed files with 15 additions and 27 deletions

View file

@ -79,6 +79,7 @@ jobs:
- datanetwork
- blockchain
- other
hub_type: ['legacy_hub', 'new_hub']
steps:
- name: Configure sysctl limits
run: |
@ -105,7 +106,10 @@ jobs:
key: tox-integration-${{ matrix.test }}-${{ hashFiles('setup.py') }}
restore-keys: txo-integration-${{ matrix.test }}-
- run: pip install tox coverage coveralls
- run: tox -e ${{ matrix.test }}
- name: run tox
env:
ENABLE_LEGACY_SEARCH: ${{ matrix.hub_type == 'legacy_hub' }}
run: tox -e ${{ matrix.test }}
- name: submit coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -364,7 +364,6 @@ class Daemon(metaclass=JSONRPCServerType):
)
def __init__(self, conf: Config, component_manager: typing.Optional[ComponentManager] = None):
self.use_go_hub = True
self.conf = conf
self.platform_info = system_info.get_platform()
self._video_file_analyzer = VideoFileAnalyzer(conf)
@ -2540,7 +2539,7 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Paginated[Output]}
"""
if self.ledger.config['use_go_hub']:
if self.ledger.config.get('use_go_hub'):
host = self.ledger.network.client.server[0]
port = "50051"
kwargs['new_sdk_server'] = f"{host}:{port}"

View file

@ -112,7 +112,6 @@ class Ledger(metaclass=LedgerRegistry):
def __init__(self, config=None):
self.config = config or {}
self.config.update({"use_go_hub": True})
self.db: Database = self.config.get('db') or Database(
os.path.join(self.path, "blockchain.db")
)

View file

@ -3,6 +3,8 @@ import json
import typing
import logging
import asyncio
from distutils.util import strtobool
from binascii import unhexlify
from decimal import Decimal
from typing import List, Type, MutableSequence, MutableMapping, Optional
@ -181,6 +183,7 @@ class WalletManager:
}[config.blockchain_name]
ledger_config = {
'use_go_hub': not strtobool(os.environ.get('ENABLE_LEGACY_SEARCH') or 'no'),
'auto_connect': True,
'explicit_servers': [],
'hub_timeout': config.hub_timeout,
@ -233,7 +236,7 @@ class WalletManager:
async def reset(self):
self.ledger.config = {
'use_go_hub': True,
'use_go_hub': not strtobool(os.environ.get('ENABLE_LEGACY_SEARCH') or 'no'),
'auto_connect': True,
'explicit_servers': [],
'default_servers': Config.lbryum_servers.default,

View file

@ -8,6 +8,8 @@ import logging
import tempfile
import subprocess
import importlib
from distutils.util import strtobool
from binascii import hexlify
from typing import Type, Optional
import urllib.request
@ -144,6 +146,7 @@ class WalletNode:
self.manager = self.manager_class.from_config({
'ledgers': {
self.ledger_class.get_id(): {
'use_go_hub': not strtobool(os.environ.get('ENABLE_LEGACY_SEARCH') or 'no'),
'api_port': self.port,
'explicit_servers': [(spv_node.hostname, spv_node.port)],
'default_servers': Config.lbryum_servers.default,
@ -555,7 +558,7 @@ class HubNode:
loop = asyncio.get_event_loop()
asyncio.get_child_watcher().attach_loop(loop)
command = [
self.daemon_bin, 'serve', '--esindex', self.spv_node.index_name + 'claims'
self.daemon_bin, 'serve', '--esindex', self.spv_node.index_name + 'claims', '--debug'
]
self.log.info(' '.join(command))
while not self.stopped:
@ -591,23 +594,3 @@ class HubNode:
def cleanup(self):
pass
async def _cli_cmnd(self, *args):
cmnd_args = [
self.daemon_bin,
] + list(args)
self.log.info(' '.join(cmnd_args))
loop = asyncio.get_event_loop()
asyncio.get_child_watcher().attach_loop(loop)
process = await asyncio.create_subprocess_exec(
*cmnd_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
out, _ = await process.communicate()
result = out.decode().strip()
self.log.info(result)
if result.startswith('error code'):
raise Exception(result)
return result
async def name_query(self, name):
return await self._cli_cmnd('--name', name)

View file

@ -8,7 +8,7 @@ changedir = {toxinidir}/tests
setenv =
HOME=/tmp
ELASTIC_HOST={env:ELASTIC_HOST:localhost}
GO_HUB=true
ENABLE_LEGACY_SEARCH={env:ENABLE_LEGACY_SEARCH:0}
commands =
orchstr8 download
blockchain: coverage run -p --source={envsitepackagesdir}/lbry -m unittest discover -vv integration.blockchain {posargs}