# Conflicts:
#	tests/testIntegration.nim
This commit is contained in:
Eric 2025-01-16 11:52:02 +11:00
parent 3846ae08a0
commit bfbb22b7b5
No known key found for this signature in database
2 changed files with 54 additions and 45 deletions

View File

@ -25,11 +25,17 @@ type
lastHardhatPort: int
lastCodexApiPort: int
lastCodexDiscPort: int
debugTestHarness: bool # output chronicles logs for the manager and multinodes harness
# Echoes stderr if there's a test failure (eg test failed, compilation
# error) or error (eg test manager error)
debugTestHarness: bool
# Echoes stdout from Hardhat process
debugHardhat: bool
debugCodexNodes: bool # output chronicles logs for the codex nodes running in the tests
timeStart: Moment
timeEnd: Moment
# Echoes stdout from the integration test file process. Codex process logs
# can also be output if a test uses a multinodesuite, requires
# CodexConfig.debug to be enabled
debugCodexNodes: bool
timeStart: ?Moment
timeEnd: ?Moment
codexPortLock: AsyncLock
hardhatPortLock: AsyncLock
hardhatProcessLock: AsyncLock
@ -92,25 +98,6 @@ proc new*(
debugCodexNodes = false,
testTimeout = 60.minutes): TestManager =
if debugTestHarness:
when enabledLogLevel != LogLevel.TRACE:
echoStyled bgWhite, fgBlack, styleBright, "\n\n ",
styleUnderscore, "ADDITIONAL LOGGING AVAILABILE\n\n",
resetStyle, bgWhite, fgBlack, styleBright, """
More integration test harness logs available by running with
-d:chronicles_log_level=TRACE, eg:""",
resetStyle, bgWhite, fgBlack,
"\n\n nim c -d:chronicles_log_level=TRACE -r ./testIntegration.nim\n\n"
if debugCodexNodes:
echoStyled bgWhite, fgBlack, styleBright, "\n\n ",
styleUnderscore, "ENABLE CODEX LOGGING\n\n",
resetStyle, bgWhite, fgBlack, styleBright, """
For integration test suites that are multinodesuites, or for
tests launching a CodexProcess, ensure that CodexConfig.debug
is enabled.
"""
TestManager(
configs: configs,
lastHardhatPort: 8545,

View File

@ -9,6 +9,7 @@
# import ./integration/testvalidator
# import ./integration/testecbug
import std/terminal
import pkg/chronos
import pkg/codex/logutils
import ./integration/testmanager
@ -18,33 +19,54 @@ import ./integration/testmanager
const TestConfigs =
@[
IntegrationTestConfig.init("./integration/testcli", startHardhat = true),
IntegrationTestConfig.init("./integration/testrestapi", startHardhat = false),
# IntegrationTestConfig.init("./integration/testupdownload", startHardhat = true),
# IntegrationTestConfig.init("./integration/testsales", startHardhat = true),
# IntegrationTestConfig.init("./integration/testpurchasing", startHardhat = true),
# IntegrationTestConfig.init("./integration/testblockexpiration", startHardhat = true),
# IntegrationTestConfig.init(
# name = "Basic Marketplace and payout tests",
# testFile = "./integration/testmarketplace",
# startHardhat = true,
),
# IntegrationTestConfig("./integration/testproofs", startHardhat = true),
# IntegrationTestConfig("./integration/testvalidator", startHardhat = true),
IntegrationTestConfig.init(
name = "Erasure Coding Bug",
testFile = "./integration/testecbug",
startHardhat = true,
)
IntegrationTestConfig.init("./integration/testrestapi", startHardhat = true),
IntegrationTestConfig.init("./integration/testupdownload", startHardhat = true),
IntegrationTestConfig.init("./integration/testsales", startHardhat = true),
IntegrationTestConfig.init("./integration/testpurchasing", startHardhat = true),
IntegrationTestConfig.init("./integration/testblockexpiration", startHardhat = true),
IntegrationTestConfig.init("./integration/testmarketplace", startHardhat = true),
IntegrationTestConfig.init("./integration/testproofs", startHardhat = true),
IntegrationTestConfig.init("./integration/testvalidator", startHardhat = true),
IntegrationTestConfig.init("./integration/testecbug", startHardhat = true)
]
proc run() {.async.} =
# Echoes stderr if there's a test failure (eg test failed, compilation error)
# or error (eg test manager error)
const debugTestHarness = false
# Echoes stdout from Hardhat process
const debugHardhat = false
# Echoes stdout from the integration test file process. Codex process logs can
# also be output if a test uses a multinodesuite, requires CodexConfig.debug
# to be enabled
const debugCodexNodes = true
when debugTestHarness and enabledLogLevel != LogLevel.TRACE:
styledEcho bgWhite,
fgBlack, styleBright, "\n\n ", styleUnderscore,
"ADDITIONAL LOGGING AVAILABILE\n\n", resetStyle, bgWhite, fgBlack, styleBright,
"""
More integration test harness logs available by running with
-d:chronicles_log_level=TRACE, eg:""",
resetStyle, bgWhite, fgBlack,
"\n\n nim c -d:chronicles_log_level=TRACE -r ./testIntegration.nim\n\n"
when debugCodexNodes:
styledEcho bgWhite,
fgBlack, styleBright, "\n\n ", styleUnderscore, "ENABLE CODEX LOGGING\n\n",
resetStyle, bgWhite, fgBlack, styleBright,
"""
For integration test suites that are multinodesuites, or for
tests launching a CodexProcess, ensure that CodexConfig.debug
is enabled.
"""
let manager = TestManager.new(
configs = TestConfigs,
debugTestHarness = true,
# Echos stderr if there's a test failure or error (error in running the test)
debugCodexNodes = true,
# Echos stdout from the Codex process (chronicles logs). If test uses a multinodesuite, requires CodexConfig.debug to be enabled
debugHardhat = false,
debugTestHarness,
debugHardhat,
debugCodexNodes,
testTimeout = 60.minutes,
)
try:
trace "starting test manager"