mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-02 21:53:05 +00:00
refactor tests
This commit is contained in:
parent
ef5a30f7d3
commit
ed34fe2d3c
@ -41,6 +41,32 @@ suite "Test Basic FSDatastore":
|
||||
removeDir(basePathAbs)
|
||||
require(not dirExists(basePathAbs))
|
||||
|
||||
suite "Test Basic FSDatastore":
|
||||
let
|
||||
path = currentSourcePath() # get this file's name
|
||||
basePath = "tests_data"
|
||||
basePathAbs = path.parentDir / basePath
|
||||
key = Key.init("/a/b").tryGet()
|
||||
bytes = "some bytes".toBytes
|
||||
otherBytes = "some other bytes".toBytes
|
||||
|
||||
var batch: seq[tuple[key: string, data: seq[byte]]]
|
||||
for k in 0..<100:
|
||||
let kk = Key.init($key, $k).tryGet().id()
|
||||
batch.add( (kk, @[k.byte]) )
|
||||
|
||||
removeDir(basePathAbs)
|
||||
require(not dirExists(basePathAbs))
|
||||
createDir(basePathAbs)
|
||||
|
||||
var
|
||||
fsStore = FSDatastore.new(root = basePathAbs, depth = 3).tryGet()
|
||||
|
||||
testBasicBackend(fsStore, key, bytes, otherBytes, batch)
|
||||
|
||||
removeDir(basePathAbs)
|
||||
require(not dirExists(basePathAbs))
|
||||
|
||||
# suite "Test Misc FSDatastore":
|
||||
# let
|
||||
# path = currentSourcePath() # get this file's name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user