Skip to content

Commit

Permalink
Separate property checked for logging schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
abailly-iohk authored and v0d1ch committed Nov 19, 2023
1 parent d211207 commit d5f1370
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions hydra-node/test/Hydra/LoggingSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Hydra.Ledger.Cardano (Tx)
import Hydra.Logging (Envelope (..), Verbosity (Verbose), traceWith, withTracer)
import Hydra.Logging.Messages (HydraLog)
import System.IO.Silently (capture_)
import Test.QuickCheck.Property (conjoin, property, withMaxSuccess)

spec :: Spec
spec = do
Expand All @@ -21,10 +20,12 @@ spec = do

captured `shouldContain` "{\"foo\":42}"

prop "HydraLog" $
property $
withMaxSuccess 1 $
conjoin
[ prop_validateJSONSchema @(Envelope (HydraLog Tx ())) "logs.json" id
, prop_specIsComplete @(HydraLog Tx ()) "logs.json" (key "properties" . key "message")
]
-- NOTE: We limit the number of successes because those tests are rather
-- slow and the underlying `Property` already generate large samples.
modifyMaxSuccess (const 5) $
prop "Validates logs.yaml schema" $
prop_validateJSONSchema @(Envelope (HydraLog Tx ())) "logs.json" id

modifyMaxSuccess (const 10) $
prop "Schema covers all defined log entries" $
prop_specIsComplete @(HydraLog Tx ()) "logs.json" (key "properties" . key "message")

0 comments on commit d5f1370

Please sign in to comment.