mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-04 22:53:08 +00:00
add second mem only tests
This commit is contained in:
parent
c36de9f5fc
commit
5cfd12daa8
53
tests/datastore/testthreadproxyds2.nim
Normal file
53
tests/datastore/testthreadproxyds2.nim
Normal file
@ -0,0 +1,53 @@
|
||||
import std/options
|
||||
import std/sequtils
|
||||
import std/os
|
||||
import std/cpuinfo
|
||||
import std/algorithm
|
||||
import std/importutils
|
||||
|
||||
import pkg/asynctest
|
||||
import pkg/chronos
|
||||
import pkg/chronos/threadsync
|
||||
import pkg/stew/results
|
||||
import pkg/stew/byteutils
|
||||
import pkg/taskpools
|
||||
import pkg/questionable/results
|
||||
import pkg/chronicles
|
||||
|
||||
import pkg/datastore/sql
|
||||
import pkg/datastore/fsds
|
||||
import pkg/datastore/memoryds
|
||||
import pkg/datastore/threads/threadproxyds {.all.}
|
||||
|
||||
import ./dscommontests
|
||||
import ./querycommontests
|
||||
|
||||
const NumThreads = 200 # IO threads aren't attached to CPU count
|
||||
|
||||
proc testBasicMemory() =
|
||||
|
||||
suite "Test Basic ThreadDatastore with SQLite":
|
||||
|
||||
var
|
||||
memStore: Datastore
|
||||
ds: ThreadDatastore
|
||||
taskPool: Taskpool
|
||||
key = Key.init("/a/b").tryGet()
|
||||
bytes = "some bytes".toBytes
|
||||
otherBytes = "some other bytes".toBytes
|
||||
|
||||
setupAll:
|
||||
memStore = MemoryDatastore.new()
|
||||
taskPool = Taskpool.new(NumThreads)
|
||||
ds = ThreadDatastore.new(memStore, tp = taskPool).tryGet()
|
||||
|
||||
teardownAll:
|
||||
(await ds.close()).tryGet()
|
||||
taskPool.shutdown()
|
||||
|
||||
basicStoreTests(ds, key, bytes, otherBytes)
|
||||
GC_fullCollect()
|
||||
|
||||
for i in 1..1000:
|
||||
testBasicMemory()
|
||||
GC_fullCollect()
|
||||
Loading…
x
Reference in New Issue
Block a user