fixes all tests

This commit is contained in:
Ben 2024-05-08 13:04:14 +02:00
parent 8dfb680d85
commit 6eec0744ad
No known key found for this signature in database
GPG Key ID: 541B9D8C9F1426A1
4 changed files with 15 additions and 4 deletions

View File

@ -42,7 +42,7 @@ proc createBlockExpirationMetadataKey*(cid: Cid): ?!Key =
BlocksTtlKey / $cid BlocksTtlKey / $cid
proc createBlockExpirationMetadataQueryKey*(): ?!Key = proc createBlockExpirationMetadataQueryKey*(): ?!Key =
let queryString = ? (BlocksTtlKey / "*") let queryString = $(BlocksTtlKey)
Key.init(queryString) Key.init(queryString)
proc createBlockCidAndProofMetadataKey*(treeCid: Cid, index: Natural): ?!Key = proc createBlockCidAndProofMetadataKey*(treeCid: Cid, index: Natural): ?!Key =

View File

@ -111,9 +111,10 @@ proc iterateKeyPrefixToQueue(self: LevelDbDatastore, query: Query, queue: AsyncQ
dec skip dec skip
else: else:
await queue.put((keyStr, valueStr)) await queue.put((keyStr, valueStr))
dec itemsLeft if query.offset > 0:
if itemsLeft < 1: dec itemsLeft
break if itemsLeft < 1:
break
# Signal to the iterator loop that we're finished. # Signal to the iterator loop that we're finished.
await queue.put(("", "")) await queue.put(("", ""))

View File

@ -137,6 +137,9 @@ template multinodesuite*(name: string, body: untyped) =
sanitize($starttime) / sanitize($starttime) /
sanitize($role & "_" & $roleIdx) sanitize($role & "_" & $roleIdx)
let metadir = getTempDir() / "CodexMeta" /
sanitize($starttime) /
sanitize($role & "_" & $roleIdx)
try: try:
if config.logFile.isSome: if config.logFile.isSome:
let updatedLogFile = getLogFile(role, some roleIdx) let updatedLogFile = getLogFile(role, some roleIdx)
@ -144,6 +147,7 @@ template multinodesuite*(name: string, body: untyped) =
config.addCliOption("--api-port", $ await nextFreePort(8080 + nodeIdx)) config.addCliOption("--api-port", $ await nextFreePort(8080 + nodeIdx))
config.addCliOption("--data-dir", datadir) config.addCliOption("--data-dir", datadir)
config.addCliOption("--meta-dir", metadir)
config.addCliOption("--nat", "127.0.0.1") config.addCliOption("--nat", "127.0.0.1")
config.addCliOption("--listen-addrs", "/ip4/127.0.0.1/tcp/0") config.addCliOption("--listen-addrs", "/ip4/127.0.0.1/tcp/0")
config.addCliOption("--disc-ip", "127.0.0.1") config.addCliOption("--disc-ip", "127.0.0.1")

View File

@ -23,7 +23,9 @@ template twonodessuite*(name: string, debug1, debug2: string, body) =
var account2 {.inject, used.}: Address var account2 {.inject, used.}: Address
let dataDir1 = getTempDir() / "Codex1" let dataDir1 = getTempDir() / "Codex1"
let metaDir1 = getTempDir() / "Codex1Meta"
let dataDir2 = getTempDir() / "Codex2" let dataDir2 = getTempDir() / "Codex2"
let metaDir2 = getTempDir() / "Codex2Meta"
setup: setup:
client1 = CodexClient.new("http://localhost:8080/api/codex/v1") client1 = CodexClient.new("http://localhost:8080/api/codex/v1")
@ -34,6 +36,7 @@ template twonodessuite*(name: string, debug1, debug2: string, body) =
var node1Args = @[ var node1Args = @[
"--api-port=8080", "--api-port=8080",
"--data-dir=" & dataDir1, "--data-dir=" & dataDir1,
"--meta-dir=" & metaDir1,
"--nat=127.0.0.1", "--nat=127.0.0.1",
"--disc-ip=127.0.0.1", "--disc-ip=127.0.0.1",
"--disc-port=8090", "--disc-port=8090",
@ -57,6 +60,7 @@ template twonodessuite*(name: string, debug1, debug2: string, body) =
var node2Args = @[ var node2Args = @[
"--api-port=8081", "--api-port=8081",
"--data-dir=" & dataDir2, "--data-dir=" & dataDir2,
"--meta-dir=" & metaDir2,
"--nat=127.0.0.1", "--nat=127.0.0.1",
"--disc-ip=127.0.0.1", "--disc-ip=127.0.0.1",
"--disc-port=8091", "--disc-port=8091",
@ -85,5 +89,7 @@ template twonodessuite*(name: string, debug1, debug2: string, body) =
removeDir(dataDir1) removeDir(dataDir1)
removeDir(dataDir2) removeDir(dataDir2)
removeDir(metaDir1)
removeDir(metaDir2)
body body