mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-09 12:35:51 +00:00
bd594c9aaf
* adding tracker for streamstore * adding tracker tests * Sets up tracker helper functions and closes streams in testnode.nim * Deploying checksuite for memory leak tracker checking. * Successfully deploys checksuite and asyncchecksuite. * Fix leak in testpor.nim * Fixes leaked storestream in testnetwork.nim * Fixes integration tests * Cleanup * cleanup comment by Mark --------- Co-authored-by: benbierens <thatbenbierens@gmail.com>
31 lines
687 B
Nim
31 lines
687 B
Nim
import pkg/codex/streams/storestream
|
|
import std/unittest
|
|
|
|
# From lip2p/tests/helpers
|
|
const trackerNames = [
|
|
StoreStreamTrackerName
|
|
]
|
|
|
|
iterator testTrackers*(extras: openArray[string] = []): TrackerBase =
|
|
for name in trackerNames:
|
|
let t = getTracker(name)
|
|
if not isNil(t): yield t
|
|
for name in extras:
|
|
let t = getTracker(name)
|
|
if not isNil(t): yield t
|
|
|
|
proc checkTracker*(name: string) =
|
|
var tracker = getTracker(name)
|
|
if tracker.isLeaked():
|
|
checkpoint tracker.dump()
|
|
fail()
|
|
|
|
proc checkTrackers*() =
|
|
for tracker in testTrackers():
|
|
if tracker.isLeaked():
|
|
checkpoint tracker.dump()
|
|
fail()
|
|
try:
|
|
GC_fullCollect()
|
|
except: discard
|