Skip to content

Commit

Permalink
Prevent tests from running concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Apr 3, 2024
1 parent d522fd6 commit bd36579
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cardano-testnet/src/Testnet/Property/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import Cardano.Chain.Genesis (GenesisHash (unGenesisHash), readGenesis
import qualified Cardano.Crypto.Hash.Blake2b as Crypto
import qualified Cardano.Crypto.Hash.Class as Crypto

import qualified Control.Exception.Lifted as E
import qualified Control.Concurrent.QSem as IO
import qualified Control.Exception.Lifted as CE
import Control.Exception.Safe (MonadCatch)
import Control.Monad
import Control.Monad.Trans.Resource
Expand Down Expand Up @@ -55,11 +56,14 @@ disableRetries = IO.unsafePerformIO $ do
return $ mValue == Just "1"
{-# NOINLINE disableRetries #-}

sem ::
sem :: IO.QSem
sem = IO.unsafePerformIO $ IO.newQSem 1
{-# NOINLINE sem #-}

-- TODO: Document what an Integration is
integration :: HasCallStack => H.Integration () -> H.Property
integration f = GHC.withFrozenCallStack $ H.withTests 1 $ H.propertyOnce $ E.bracket_ (pure ()) (pure ()) f
integration f = GHC.withFrozenCallStack $ H.withTests 1 $ H.propertyOnce $
CE.bracket_ (liftIO $ IO.waitQSem sem) (liftIO $ IO.signalQSem sem) f

-- | The 'FilePath' in '(FilePath -> H.Integration ())' is the work space directory.
-- This is created (and returned) via 'H.workspace'.
Expand Down

0 comments on commit bd36579

Please sign in to comment.