2019-10-19 08:47:24 +00:00
|
|
|
import os
|
|
|
|
|
2021-01-17 04:58:28 +00:00
|
|
|
import oldblocks
|
2019-10-19 08:47:24 +00:00
|
|
|
import logger
|
|
|
|
import coredb
|
|
|
|
from onionrutils import epoch
|
|
|
|
|
|
|
|
def stress_test_block_insert(testmanager):
|
2019-12-22 19:42:10 +00:00
|
|
|
return
|
2019-10-19 08:47:24 +00:00
|
|
|
start = epoch.get_epoch()
|
|
|
|
count = 100
|
|
|
|
max_insert_speed = 120
|
2021-01-17 04:58:28 +00:00
|
|
|
for x in range(count): oldblocks.insert(os.urandom(32))
|
2019-10-19 08:47:24 +00:00
|
|
|
speed = epoch.get_epoch() - start
|
|
|
|
if speed < max_insert_speed:
|
|
|
|
raise ValueError(f'{count} blocks inserted too fast, {max_insert_speed}, got {speed}')
|
|
|
|
logger.info(f'runtest stress block insertion: {count} blocks inserted in {speed}s')
|