lock hardhat start to avoid intermittent start failures

This commit is contained in:
Eric 2025-01-15 10:40:12 +11:00
parent 3a2438b3ff
commit ef72240c9b
No known key found for this signature in database

View File

@ -32,6 +32,7 @@ type
timeEnd: Moment
codexPortLock: AsyncLock
hardhatPortLock: AsyncLock
hardhatProcessLock: AsyncLock
testTimeout: Duration # individual test timeout
IntegrationTestConfig* = object
@ -177,15 +178,16 @@ proc startHardhat(
trace "starting hardhat process on port ", port
try:
let node = await HardhatProcess.startNode(
args,
false,
"hardhat for '" & config.name & "'",
onOutputLineCaptured)
await node.waitUntilStarted()
hardhat.process = node
hardhat.port = port
return hardhat
withLock(test.manager.hardhatProcessLock):
let node = await HardhatProcess.startNode(
args,
false,
"hardhat for '" & test.config.name & "'",
onOutputLineCaptured)
hardhat.process = node
hardhat.port = port
await node.waitUntilStarted()
return hardhat
except CancelledError as e:
raise e
except CatchableError as e: