2022-04-20 16:27:59 +02:00
|
|
|
# standard imports
|
|
|
|
import unittest
|
|
|
|
import logging
|
|
|
|
|
|
|
|
# local imports
|
|
|
|
from chainsyncer.store.rocksdb import SyncRocksDbStore
|
2022-04-20 17:15:43 +02:00
|
|
|
from chainsyncer.unittest.store import TestStoreBase
|
2022-04-20 16:27:59 +02:00
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
logg = logging.getLogger()
|
|
|
|
|
2022-04-20 17:15:43 +02:00
|
|
|
class StoreFactory:
|
2022-04-20 16:27:59 +02:00
|
|
|
|
2022-04-20 17:15:43 +02:00
|
|
|
def __init__(self, path):
|
|
|
|
self.path = path
|
2022-04-20 16:27:59 +02:00
|
|
|
|
2022-04-20 17:15:43 +02:00
|
|
|
|
|
|
|
def create(self, session_id=None):
|
|
|
|
return SyncRocksDbStore(self.path, session_id=session_id)
|
2022-04-20 16:27:59 +02:00
|
|
|
|
|
|
|
|
2022-04-20 17:15:43 +02:00
|
|
|
class TestRocksDb(TestStoreBase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
super(TestRocksDb, self).setUp()
|
|
|
|
self.store_factory = StoreFactory(self.path).create
|
2022-04-20 16:27:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2022-04-20 17:15:43 +02:00
|
|
|
TestStoreBase.link(TestRocksDb)
|
2022-04-20 16:27:59 +02:00
|
|
|
unittest.main()
|