fix testblockexpiration failing occassionally

This was due to a port clash, and the codex nodes would not start.
This commit is contained in:
Eric 2025-01-28 21:03:49 +11:00
parent 971dadda46
commit ed48f50367
No known key found for this signature in database

View File

@ -1,5 +1,6 @@
import std/os
import std/httpclient
import std/strformat
import std/strutils
from std/net import TimeoutError
@ -8,6 +9,9 @@ import ../ethertest
import ./codexprocess
import ./nodeprocess
const CodexApiPort {.intdefine.}: int = 8080
const CodexDiscPort {.intdefine.}: int = 8090
ethersuite "Node block expiration tests":
var node: CodexProcess
var baseurl: string
@ -16,7 +20,7 @@ ethersuite "Node block expiration tests":
let content = "test file content"
setup:
baseurl = "http://localhost:8080/api/codex/v1"
baseurl = &"http://localhost:{CodexApiPort}/api/codex/v1"
teardown:
await node.stop()
@ -26,11 +30,11 @@ ethersuite "Node block expiration tests":
proc startTestNode(blockTtlSeconds: int) {.async.} =
node = await CodexProcess.startNode(
@[
"--api-port=8080",
&"--api-port={CodexApiPort}",
"--data-dir=" & dataDir,
"--nat=none",
"--listen-addrs=/ip4/127.0.0.1/tcp/0",
"--disc-port=8090",
&"--disc-port={CodexDiscPort}",
"--block-ttl=" & $blockTtlSeconds,
"--block-mi=1",
"--block-mn=10",