Skip to content

Commit

Permalink
feat: provide time indication for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theobat committed Jun 22, 2024
1 parent fd4f73e commit 528881b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/integration/IntegrationSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import RIO.Process
)
import qualified RIO.Set as Set
import qualified RIO.Text as T
import RIO.Time ( defaultTimeLocale, diffUTCTime, formatTime, getCurrentTime )
import System.Environment ( getExecutablePath, lookupEnv )
import System.Info ( os )
import System.PosixCompat.Files ( createSymbolicLink )
Expand All @@ -43,6 +44,7 @@ main = runSimpleApp $ do
logInfo "Initiating Stack integration test running"

options <- getRecord "Stack integration tests"
startTime <- getCurrentTime
results <- runApp options $ do
logInfo "Running with the following environment"
proc "env" [] runProcess_
Expand All @@ -62,10 +64,12 @@ main = runSimpleApp $ do
loop (idx + 1) rest' (res <> accum)

loop (1 :: Int) (Set.toList tests) mempty

finalTime <- getCurrentTime
let (successes, failures) = partition ((== ExitSuccess) . snd)
$ Map.toList results

let timeDiff = diffUTCTime finalTime startTime
let timeDiffStr = formatTime defaultTimeLocale "%H:%M:%S - total %s seconds" timeDiff
logInfo $ "Integration tests ran in : " <> fromString timeDiffStr
unless (null successes) $ do
logInfo "Successful tests:"
for_ successes $ \(x, _) -> logInfo $ "- " <> display x
Expand All @@ -78,6 +82,7 @@ main = runSimpleApp $ do
for_ failures $ \(x, ec) -> logInfo $ "- " <> display x <> " - " <> displayShow ec
exitFailure


data Options = Options
{ optSpeed :: Maybe Speed
, optMatch :: Maybe String
Expand Down

0 comments on commit 528881b

Please # to comment.