default test name to the filename of the integration test

# Conflicts:
#	tests/testIntegration.nim
This commit is contained in:
Eric 2025-01-13 14:39:07 +11:00
parent 2c31818f39
commit 95021aaa71
No known key found for this signature in database
2 changed files with 34 additions and 19 deletions

View File

@ -30,9 +30,9 @@ type
testTimeout: Duration # individual test timeout testTimeout: Duration # individual test timeout
IntegrationTestConfig* = object IntegrationTestConfig* = object
startHardhat*: bool startHardhat: bool
testFile*: string testFile: string
name*: string name: string
IntegrationTestStatus = enum ## The status of a test when it is done. IntegrationTestStatus = enum ## The status of a test when it is done.
Ok, # tests completed and all succeeded Ok, # tests completed and all succeeded
@ -87,6 +87,21 @@ proc new*(
testTimeout: testTimeout testTimeout: testTimeout
) )
func init*(
_: type IntegrationTestConfig,
testFile: string,
startHardhat: bool,
name = ""): IntegrationTestConfig =
IntegrationTestConfig(
testFile: testFile,
name: if name == "":
testFile.extractFilename
else:
name,
startHardhat: startHardhat
)
template withLock*(lock: AsyncLock, body: untyped) = template withLock*(lock: AsyncLock, body: untyped) =
if lock.isNil: if lock.isNil:
lock = newAsyncLock() lock = newAsyncLock()

View File

@ -17,23 +17,23 @@ import ./integration/testmanager
const TestConfigs = const TestConfigs =
@[ @[
# IntegrationTestConfig(testFile: "./integration/testcli", startHardhat: true), IntegrationTestConfig.init("./integration/testcli", startHardhat = true),
# IntegrationTestConfig(testFile: "./integration/testrestapi", startHardhat: true), IntegrationTestConfig.init("./integration/testrestapi", startHardhat = false),
# IntegrationTestConfig(testFile: "./integration/testupdownload", startHardhat: true), # IntegrationTestConfig.init("./integration/testupdownload", startHardhat = true),
# IntegrationTestConfig(testFile: "./integration/testsales", startHardhat: true), # IntegrationTestConfig.init("./integration/testsales", startHardhat = true),
# IntegrationTestConfig(testFile: "./integration/testpurchasing", startHardhat: true), # IntegrationTestConfig.init("./integration/testpurchasing", startHardhat = true),
# IntegrationTestConfig(testFile: "./integration/testblockexpiration", startHardhat: true), # IntegrationTestConfig.init("./integration/testblockexpiration", startHardhat = true),
IntegrationTestConfig( # IntegrationTestConfig.init(
name: "Basic Marketplace and payout tests", # name = "Basic Marketplace and payout tests",
testFile: "./integration/testmarketplace", # testFile = "./integration/testmarketplace",
startHardhat: true, # startHardhat = true,
), ),
# IntegrationTestConfig(testFile: "./integration/testproofs", startHardhat: true), # IntegrationTestConfig("./integration/testproofs", startHardhat = true),
# IntegrationTestConfig(testFile: "./integration/testvalidator", startHardhat: true), # IntegrationTestConfig("./integration/testvalidator", startHardhat = true),
IntegrationTestConfig( IntegrationTestConfig.init(
name: "Erasure Coding Bug", name = "Erasure Coding Bug",
testFile: "./integration/testecbug", testFile = "./integration/testecbug",
startHardhat: true, startHardhat = true,
) )
] ]