added mixmate to improve base routing

This commit is contained in:
Kevin Froman 2019-12-22 13:42:10 -06:00
parent f71f2f6246
commit 9329b07e3b
15 changed files with 273 additions and 67 deletions

View file

@ -7,6 +7,7 @@ import logger
from onionrutils import epoch
from . import uicheck, inserttest, stresstest
from . import ownnode
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -24,7 +25,10 @@ from . import uicheck, inserttest, stresstest
RUN_TESTS = [uicheck.check_ui,
inserttest.insert_bin_test,
stresstest.stress_test_block_insert]
ownnode.test_tor_adder,
ownnode.test_own_node,
stresstest.stress_test_block_insert
]
class OnionrRunTestManager:
@ -35,10 +39,11 @@ class OnionrRunTestManager:
def run_tests(self):
cur_time = epoch.get_epoch()
logger.info(f"Doing runtime tests at {cur_time}")
try:
for i in RUN_TESTS:
last = i
i(self)
logger.info(last.__name__ + " passed")
except ValueError:
logger.info("[RUNTIME TEST] " + last.__name__ + " passed")
except (ValueError, AttributeError):
logger.error(last.__name__ + ' failed')

53
src/runtests/ownnode.py Normal file
View file

@ -0,0 +1,53 @@
"""Onionr - Private P2P Communication.
Test own Onionr node as it is running
"""
import config
from onionrutils import basicrequests
from utils import identifyhome
from utils import gettransports
import logger
from onionrutils import localcommand
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
def test_own_node(test_manager):
socks_port = localcommand.local_command('/gettorsocks')
if config.get('general.security_level', 0) > 0:
return
own_tor_address = gettransports.get()[0]
print(socks_port)
if 'this is an onionr node' \
not in basicrequests.do_get_request(own_tor_address,
port=socks_port).lower():
logger.warn('Own node not reachable in test')
raise ValueError
def test_tor_adder(test_manager):
if config.get('general.security_level', 0) > 0:
return
with open(identifyhome.identify_home() + 'hs/hostname', 'r') as hs:
hs = hs.read().strip()
if not hs:
logger.error('No Tor node address created yet')
raise ValueError('No Tor node address created yet')
if hs not in gettransports.get():
print(hs in gettransports.get(), 'meme')
logger.error('gettransports Tor not same as file: %s %s' %
(hs, gettransports.get()))
raise ValueError('gettransports Tor not same as file')

View file

@ -6,6 +6,7 @@ import coredb
from onionrutils import epoch
def stress_test_block_insert(testmanager):
return
start = epoch.get_epoch()
count = 100
max_insert_speed = 120