Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Fix fossa test always fail #279

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/App/Fossa/Report.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import App.Types
import Control.Carrier.Diagnostics
import Control.Carrier.StickyLogger (logSticky, runStickyLogger)
import Data.Aeson qualified as Aeson
import Data.Functor (void)
import Data.String.Conversion (decodeUtf8)
import Data.Text (Text)
import Data.Text.IO (hPutStrLn)
Expand Down Expand Up @@ -49,7 +48,7 @@ reportMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds reportType overr
* Timeout over `IO a` (easy to move, but where do we move it?)
* CLI command refactoring as laid out in https://github.com/fossas/issues/issues/129
-}
void . timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
result <- timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
logWithExit_ . runReadFSIO $ do
revision <- mergeOverride override <$> (inferProjectFromVCS basedir <||> inferProjectCached basedir <||> inferProjectDefault basedir)

Expand All @@ -73,5 +72,8 @@ reportMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds reportType overr

logStdout . decodeUtf8 $ Aeson.encode jsonValue

hPutStrLn stderr "Timed out while waiting for build/issues scan"
exitFailure
case result of
Just _ -> pure ()
Nothing -> do
hPutStrLn stderr "Timed out while waiting for build/issues scan"
exitFailure
10 changes: 6 additions & 4 deletions src/App/Fossa/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Control.Carrier.Diagnostics hiding (fromMaybe)
import Control.Carrier.StickyLogger (logSticky, runStickyLogger)
import Control.Effect.Lift (sendIO)
import Data.Aeson qualified as Aeson
import Data.Functor (void)
import Data.String.Conversion (decodeUtf8)
import Data.Text.IO (hPutStrLn)
import Effect.Logger
Expand All @@ -35,7 +34,7 @@ testMain ::
OverrideProject ->
IO ()
testMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds outputType override = do
void . timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
result <- timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
logWithExit_ . runReadFSIO $ do
revision <- mergeOverride override <$> (inferProjectFromVCS basedir <||> inferProjectCached basedir <||> inferProjectDefault basedir)

Expand Down Expand Up @@ -66,5 +65,8 @@ testMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds outputType overrid

-- we call exitSuccess/exitFailure in each branch above. the only way we get
-- here is if we time out
hPutStrLn stderr "Timed out while waiting for issues scan"
exitFailure
case result of
Just _ -> pure ()
Nothing -> do
hPutStrLn stderr "Timed out while waiting for issues scan"
exitFailure
10 changes: 6 additions & 4 deletions src/App/Fossa/VPS/Report.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import App.Types
import Control.Carrier.Diagnostics
import Control.Carrier.StickyLogger (logSticky, runStickyLogger)
import Data.Aeson qualified as Aeson
import Data.Functor (void)
import Data.String.Conversion (decodeUtf8)
import Data.Text (Text)
import Data.Text.IO (hPutStrLn)
Expand Down Expand Up @@ -51,7 +50,7 @@ reportMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds reportType overr
* Timeout over `IO a` (easy to move, but where do we move it?)
* CLI command refactoring as laid out in https://github.com/fossas/issues/issues/129
-}
void . timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
result <- timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
logWithExit_ . runReadFSIO $ do
revision <- mergeOverride override <$> (inferProjectFromVCS basedir <||> inferProjectCached basedir <||> inferProjectDefault basedir)

Expand All @@ -76,5 +75,8 @@ reportMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds reportType overr

logStdout . decodeUtf8 $ Aeson.encode jsonValue

hPutStrLn stderr "Timed out while waiting for build/issues scan"
exitFailure
case result of
Just _ -> pure ()
Nothing -> do
hPutStrLn stderr "Timed out while waiting for build/issues scan"
exitFailure
9 changes: 6 additions & 3 deletions src/App/Fossa/VPS/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ testMain ::
OverrideProject ->
IO ()
testMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds outputType override = do
_ <- timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
result <- timeout timeoutSeconds . withDefaultLogger logSeverity . runStickyLogger SevInfo $
logWithExit_ . runReadFSIO $ do
revision <- mergeOverride override <$> (inferProjectFromVCS basedir <||> inferProjectCached basedir <||> inferProjectDefault basedir)

Expand Down Expand Up @@ -73,5 +73,8 @@ testMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds outputType overrid

-- we call exitSuccess/exitFailure in each branch above. the only way we get
-- here is if we time out
hPutStrLn stderr "Timed out while waiting for issues scan"
exitFailure
case result of
Just _ -> pure ()
Nothing -> do
hPutStrLn stderr "Timed out while waiting for issues scan"
exitFailure