Onionr/src/runtests/housekeeping.py

25 lines
751 B
Python
Raw Normal View History

from gevent import sleep
from oldblocks import insert
2021-02-04 01:52:36 +00:00
import config
from coredb.blockmetadb import get_block_list
def test_inserted_housekeeping(testmanager):
"""Tests that inserted blocks are proprely deleted"""
2021-02-04 01:52:36 +00:00
if config.get('runtests.skip_slow', False):
return
bl = insert('testdata', expire=12)
wait_seconds = 132 # Wait two minutes plus expire time
count = 0
if bl in get_block_list():
while count < wait_seconds:
if bl in get_block_list():
2020-03-19 06:43:02 +00:00
sleep(0.8)
count += 1
else:
return
raise ValueError('Inserted block with expiry not erased')
else:
raise ValueError('Inserted block in expiry test not present in list')