From 3825899b0b54e8272e24119c6120305a9d3e5a97 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Thu, 14 Sep 2023 21:35:58 -0700 Subject: [PATCH] update tests --- datastore/threadproxyds.nim | 2 +- datastore/threads/sharedptr.nim | 2 +- tests/datastore/testthreadproxyds.nim | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/datastore/threadproxyds.nim b/datastore/threadproxyds.nim index c762c08..bbc1850 100644 --- a/datastore/threadproxyds.nim +++ b/datastore/threadproxyds.nim @@ -211,7 +211,7 @@ proc newThreadProxyDatastore*( try: value[].ds = ds - value[].tp = Taskpool.new(num_threads = 6) + value[].tp = Taskpool.new(num_threads = 2) except Exception as exc: return err((ref DatastoreError)(msg: exc.msg)) diff --git a/datastore/threads/sharedptr.nim b/datastore/threads/sharedptr.nim index bcf1803..3fe4613 100644 --- a/datastore/threads/sharedptr.nim +++ b/datastore/threads/sharedptr.nim @@ -19,7 +19,7 @@ template checkNotNil(p: typed) = when not defined(datastoreEchoedThread): - proc echoed*(vals: varargs[string]) = + template echoed*(vals: varargs[untyped]) = discard else: import std/terminal diff --git a/tests/datastore/testthreadproxyds.nim b/tests/datastore/testthreadproxyds.nim index fdc7822..59acb84 100644 --- a/tests/datastore/testthreadproxyds.nim +++ b/tests/datastore/testthreadproxyds.nim @@ -52,11 +52,23 @@ suite "Test Basic ThreadProxyDatastore": val &= char(c) # print "get res2: ", $val +suite "Test Basics": + var + mem = MemoryDatastore.new() + sds = newThreadProxyDatastore(mem).expect("should work") + + let + key = Key.init("/a/b").tryGet() + bytes = "some bytes".toBytes + otherBytes = "some other bytes".toBytes + # echo "\n\n=== put cancel ===" # # let res1 = await sds.put(key1, "value for 1".toBytes()) # let res3 = sds.put(key1, "value for 1".toBytes()) # res3.cancel() # # print "res3: ", res3 + + basicStoreTests(sds, key, bytes, otherBytes) # suite "Test Basic ThreadProxyDatastore":