2017-06-19 07:59:31 +02:00
|
|
|
# content of test_sample.py
|
|
|
|
import rocksdb
|
|
|
|
import pytest
|
|
|
|
import shutil
|
|
|
|
import os
|
2018-11-02 19:27:14 +01:00
|
|
|
import tempfile
|
2017-06-19 07:59:31 +02:00
|
|
|
|
|
|
|
def test_open_skiplist_memtable_factory():
|
|
|
|
opts = rocksdb.Options()
|
|
|
|
opts.memtable_factory = rocksdb.SkipListMemtableFactory()
|
|
|
|
opts.create_if_missing = True
|
2018-11-02 19:27:14 +01:00
|
|
|
|
|
|
|
loc = tempfile.mkdtemp()
|
|
|
|
try:
|
|
|
|
test_db = rocksdb.DB(os.path.join(loc, "test"), opts)
|
|
|
|
finally:
|
|
|
|
shutil.rmtree(loc)
|
|
|
|
|
2017-06-19 07:59:31 +02:00
|
|
|
|
|
|
|
def test_open_vector_memtable_factory():
|
|
|
|
opts = rocksdb.Options()
|
|
|
|
opts.allow_concurrent_memtable_write = False
|
|
|
|
opts.memtable_factory = rocksdb.VectorMemtableFactory()
|
|
|
|
opts.create_if_missing = True
|
2018-11-02 19:27:14 +01:00
|
|
|
loc = tempfile.mkdtemp()
|
|
|
|
try:
|
|
|
|
test_db = rocksdb.DB(os.path.join(loc, "test"), opts)
|
|
|
|
finally:
|
|
|
|
shutil.rmtree(loc)
|