mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-17 10:12:33 +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>
35 lines
884 B
Nim
35 lines
884 B
Nim
import std/unittest
|
|
import std/os
|
|
import pkg/libp2p
|
|
import pkg/questionable/results
|
|
import codex/utils/keyutils
|
|
import ../helpers
|
|
|
|
when defined(windows):
|
|
import stew/windows/acl
|
|
|
|
checksuite "keyutils":
|
|
let path = getTempDir() / "CodexTest"
|
|
|
|
setup:
|
|
os.createDir(path)
|
|
|
|
teardown:
|
|
os.removeDir(path)
|
|
|
|
test "creates a key file when it does not exist yet":
|
|
check setupKey(path / "keyfile").isSuccess
|
|
check fileExists(path / "keyfile")
|
|
|
|
test "stores key in a file that's only readable by the user":
|
|
discard !setupKey(path / "keyfile")
|
|
when defined(posix):
|
|
check getFilePermissions(path / "keyfile") == {fpUserRead, fpUserWrite}
|
|
when defined(windows):
|
|
check checkCurrentUserOnlyACL(path / "keyfile").get()
|
|
|
|
test "reads key file when it does exist":
|
|
let key = !setupKey(path / "keyfile")
|
|
check !setupKey(path / "keyfile") == key
|
|
|