def test_open(self): with patch('faust.stores.rocksdb.rocksdb', Mock()) as rocks: opts = RocksDBOptions() db = opts.open(Path('foo.db'), read_only=True) rocks.DB.assert_called_once_with( 'foo.db', opts.as_options(), read_only=True) assert db is rocks.DB()
def test_defaults(self): opts = RocksDBOptions() assert opts.max_open_files == rocksdb.DEFAULT_MAX_OPEN_FILES assert opts.write_buffer_size == rocksdb.DEFAULT_WRITE_BUFFER_SIZE assert opts.max_write_buffer_number == rocksdb.DEFAULT_MAX_WRITE_BUFFER_NUMBER assert opts.target_file_size_base == rocksdb.DEFAULT_TARGET_FILE_SIZE_BASE assert opts.block_cache_size == rocksdb.DEFAULT_BLOCK_CACHE_SIZE assert (opts.block_cache_compressed_size == rocksdb.DEFAULT_BLOCK_CACHE_COMPRESSED_SIZE) assert opts.bloom_filter_size == rocksdb.DEFAULT_BLOOM_FILTER_SIZE
def test_init(self, arg): opts = RocksDBOptions(**{arg: 30}) assert getattr(opts, arg) == 30