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 fe84c66
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 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 ( getCurrentTime, diffUTCTime, formatTime, defaultTimeLocale )
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 @@ -60,12 +62,14 @@ main = runSimpleApp $ do
<> fromString (takeFileName next)
res <- test next
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" timeDiff
logInfo (fromString ("Integration tests ran in : " ++ timeDiffStr))
unless (null successes) $ do
logInfo "Successful tests:"
for_ successes $ \(x, _) -> logInfo $ "- " <> display x
Expand All @@ -77,6 +81,7 @@ main = runSimpleApp $ do
logInfo "Failed tests:"
for_ failures $ \(x, ec) -> logInfo $ "- " <> display x <> " - " <> displayShow ec
exitFailure


data Options = Options
{ optSpeed :: Maybe Speed
Expand Down

0 comments on commit fe84c66

Please sign in to comment.