Skip to content

Commit

Permalink
Enable CDDL test file to be found in both cabal and nix builds
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmayhew committed Nov 2, 2023
1 parent 417ddbe commit 517eae2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
File renamed without changes.
7 changes: 6 additions & 1 deletion cardano-node/test/Test/Cardano/Node/LedgerEvent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ import Data.String (IsString(..))
import Data.Text (Text)
import Hedgehog (Property, discover, footnote)
import qualified Hedgehog
import qualified Hedgehog.Internal.Property as Hedgehog
import qualified Hedgehog.Extras.Test.Process as Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import System.FilePath ((</>))
import System.IO.Unsafe (unsafePerformIO)
import qualified Data.Text as T
import qualified Data.Text.IO as TIO

specification :: Text
specification =
unsafePerformIO $ TIO.readFile "./ledger_events.cddl"
unsafePerformIO $ do
base <- either (fail . show) pure . fst =<< Hedgehog.runTestT Hedgehog.getProjectBase
TIO.readFile $ base </> "cardano-node/test-data/ledger_events.cddl"
{-# NOINLINE specification #-}

prop_roundtrip_LedgerEvent_CBOR :: Property
Expand Down
4 changes: 3 additions & 1 deletion nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ let
packages.cardano-node.components.tests.cardano-node-test.preCheck =
let
# This define files included in the directory that will be passed to `H.getProjectBase` for this test:
filteredProjectBase = incl ../. mainnetConfigFiles;
filteredProjectBase = incl ../. (mainnetConfigFiles ++ [
"cardano-node/test-data/ledger_events.cddl"
]);
in
''
export CARDANO_NODE_SRC=${filteredProjectBase}
Expand Down

0 comments on commit 517eae2

Please sign in to comment.