2020-03-04 06:59:29 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
from gevent import sleep
|
|
|
|
|
|
|
|
from onionrblocks import insert
|
|
|
|
import logger
|
|
|
|
from coredb.blockmetadb import get_block_list
|
|
|
|
from onionrutils import epoch
|
|
|
|
|
|
|
|
|
|
|
|
def test_inserted_housekeeping(testmanager):
|
|
|
|
"""Tests that inserted blocks are proprely deleted"""
|
|
|
|
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)
|
2020-03-04 06:59:29 +00:00
|
|
|
count += 1
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
raise ValueError('Inserted block with expiry not erased')
|
|
|
|
else:
|
|
|
|
raise ValueError('Inserted block in expiry test not present in list')
|