Skip to content

Commit

Permalink
fix: some hsec-sync do not work on GitHub Actions Runners
Browse files Browse the repository at this point in the history
  • Loading branch information
blackheaven committed Mar 29, 2024
1 parent 5d3aea9 commit c49d316
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/hsec-sync/test/Spec/SyncSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

module Spec.SyncSpec (spec) where

import Control.Monad (unless)
import Data.Bifunctor (first)
import Security.Advisories.Sync
import qualified System.Directory as D
import System.Environment (lookupEnv)
import System.Exit (ExitCode (ExitSuccess))
import System.FilePath ((</>))
import System.IO.Temp (withSystemTempDirectory)
Expand All @@ -22,8 +24,11 @@ spec =
[ testCase "Invalid root should fail" $ do
let repo = withRepositoryAt "/dev/advisories"
status repo >>= (@?= DirectoryMissing)
result <- sync repo
first (const ("<Redacted error>" :: String)) result @?= Left "<Redacted error>"
isGitHubActionRunner <- lookupEnv "GITHUB_ACTIONS"
unless (isGitHubActionRunner == Just "true") $ do
-- GitHub Action runners let you write anywhere
result <- sync repo
first (const ("<Redacted error>" :: String)) result @?= Left "<Redacted error>"
status repo >>= (@?= DirectoryMissing),
testCase "Subdirectory creation should work" $
withSystemTempDirectory "hsec-sync" $ \p -> do
Expand Down

0 comments on commit c49d316

Please sign in to comment.