Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 528881b

Browse files
committedJun 22, 2024·
feat: provide time indication for integration tests
1 parent fd4f73e commit 528881b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎tests/integration/IntegrationSpec.hs

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import RIO.Process
3131
)
3232
import qualified RIO.Set as Set
3333
import qualified RIO.Text as T
34+
import RIO.Time ( defaultTimeLocale, diffUTCTime, formatTime, getCurrentTime )
3435
import System.Environment ( getExecutablePath, lookupEnv )
3536
import System.Info ( os )
3637
import System.PosixCompat.Files ( createSymbolicLink )
@@ -43,6 +44,7 @@ main = runSimpleApp $ do
4344
logInfo "Initiating Stack integration test running"
4445

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

6466
loop (1 :: Int) (Set.toList tests) mempty
65-
67+
finalTime <- getCurrentTime
6668
let (successes, failures) = partition ((== ExitSuccess) . snd)
6769
$ Map.toList results
68-
70+
let timeDiff = diffUTCTime finalTime startTime
71+
let timeDiffStr = formatTime defaultTimeLocale "%H:%M:%S - total %s seconds" timeDiff
72+
logInfo $ "Integration tests ran in : " <> fromString timeDiffStr
6973
unless (null successes) $ do
7074
logInfo "Successful tests:"
7175
for_ successes $ \(x, _) -> logInfo $ "- " <> display x
@@ -78,6 +82,7 @@ main = runSimpleApp $ do
7882
for_ failures $ \(x, ec) -> logInfo $ "- " <> display x <> " - " <> displayShow ec
7983
exitFailure
8084

85+
8186
data Options = Options
8287
{ optSpeed :: Maybe Speed
8388
, optMatch :: Maybe String

0 commit comments

Comments
 (0)
Please sign in to comment.