diff --git a/tests/integration/testmanager.nim b/tests/integration/testmanager.nim index 4d5097f3..08822523 100644 --- a/tests/integration/testmanager.nim +++ b/tests/integration/testmanager.nim @@ -157,6 +157,16 @@ proc duration(manager: TestManager): Duration = let now = Moment.now() (manager.timeEnd |? now) - (manager.timeStart |? now) +proc testsStatus*(manager: TestManager): ?!bool = + for test in manager.tests: + if test.status in {IntegrationTestStatus.New, IntegrationTestStatus.Running}: + return failure "Integration tests not complete" + + if test.status != IntegrationTestStatus.Ok: + return success true + + return success false + proc duration(test: IntegrationTest): Duration = let now = Moment.now() (test.timeEnd |? now) - (test.timeStart |? now) diff --git a/tests/testIntegration.nim b/tests/testIntegration.nim index f3713595..bc076f3a 100644 --- a/tests/testIntegration.nim +++ b/tests/testIntegration.nim @@ -72,4 +72,10 @@ proc run() {.async.} = trace "stopping test manager" await manager.stop() + without wasSuccessful =? manager.testsStatus, error: + raiseAssert "Failed to get test status: " & error.msg + + if not wasSuccessful: + quit(1) # indicate with a non-zero exit code that the tests failed + waitFor run()