-
Notifications
You must be signed in to change notification settings - Fork 749
Enhancements and fixes related to logging, metrics, and testing #6052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
456b040
cardano-node: forging_enabled metrics respects non producing node flag
jutaro 495634a
cardano-node: Add mainnet config test case
jutaro a2d1784
cardano-node: Fixes
jutaro 4a2ff74
Review changes
jutaro 437f2db
cardano-node: tipBlockHash metrics and tracing properties
jutaro 2146f13
cardano-node | tests: internal/external subdir resolution for new
jutaro afaf32e
cardano-node: metrics comments
jutaro 5c4f271
cardano-node: fix typos
jutaro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 51 additions & 26 deletions
77
cardano-node/test/Test/Cardano/Tracing/NewTracing/Consistency.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,67 @@ | ||
| {-# LANGUAGE FlexibleContexts #-} | ||
|
|
||
|
|
||
| -- | Check namespace consistencies agains configurations | ||
| module Test.Cardano.Tracing.NewTracing.Consistency (tests) where | ||
|
|
||
| import Cardano.Node.Tracing.Consistency (checkNodeTraceConfiguration) | ||
|
|
||
| import Control.Monad.IO.Class (liftIO) | ||
| import Control.Monad.IO.Class (MonadIO) | ||
| import Data.Text | ||
| import qualified System.Directory as IO | ||
| import System.FilePath ((</>)) | ||
|
|
||
| import Hedgehog (Property) | ||
| import qualified Hedgehog as H | ||
| import qualified Hedgehog.Extras.Test.Base as H.Base | ||
| import qualified Hedgehog.Extras.Test.Base as H | ||
| import qualified Hedgehog.Extras.Test.Process as H | ||
| import Hedgehog.Internal.Property (PropertyName (PropertyName)) | ||
|
|
||
| tests :: IO Bool | ||
| tests = H.checkSequential | ||
| tests :: MonadIO m => m Bool | ||
| tests = do | ||
| H.checkSequential | ||
| $ H.Group "Configuration Consistency tests" | ||
| $ test | ||
| <$> [ ( [] | ||
| , "goodConfig.yaml") | ||
| , ( [ "Config namespace error: Illegal namespace ChainDB.CopyToImmutableDBEvent2.CopiedBlockToImmutableDB" | ||
| , "Config namespace error: Illegal namespace SubscriptionDNS" | ||
| ] | ||
| , "badConfig.yaml") | ||
| -- TODO: add mainnet config as good | ||
| ] | ||
| $ Prelude.map test | ||
| [ ( [] | ||
| -- This file name should reference the current standard config with new tracing | ||
| , configSubdir | ||
| , "mainnet-config-new-tracing.json" | ||
| ) | ||
| , | ||
| ( [] | ||
| , testSubdir | ||
| , "goodConfig.yaml" | ||
| ) | ||
| , ( [ "Config namespace error: Illegal namespace ChainDB.CopyToImmutableDBEvent2.CopiedBlockToImmutableDB" | ||
| , "Config namespace error: Illegal namespace SubscriptionDNS" | ||
| ] | ||
| , testSubdir | ||
| , "badConfig.yaml" | ||
| ) | ||
| ] | ||
| where | ||
| test (actualValue, goldenBaseName) = | ||
| (PropertyName goldenBaseName, goldenTestJSON actualValue goldenBaseName) | ||
| test (actualValue, subDir, goldenBaseName) = | ||
| (PropertyName goldenBaseName, goldenTestJSON subDir actualValue goldenBaseName) | ||
|
|
||
| goldenTestJSON :: SubdirSelection -> [Text] -> FilePath -> Property | ||
| goldenTestJSON subDir expectedOutcome goldenFileBaseName = | ||
| H.withTests 1 $ H.withShrinks 0 $ H.property $ do | ||
| base <- resolveDir | ||
| goldenFp <- H.note $ base </> goldenFileBaseName | ||
| actualValue <- H.evalIO $ checkNodeTraceConfiguration goldenFp | ||
| actualValue H.=== expectedOutcome | ||
| where | ||
| resolveDir = case subDir of | ||
| ExternalSubdir d -> do | ||
| base <- H.evalIO . IO.canonicalizePath =<< H.getProjectBase | ||
| pure $ base </> d | ||
| InternalSubdir d -> | ||
| pure d | ||
|
|
||
| goldenTestJSON :: [Text] -> FilePath -> Property | ||
| goldenTestJSON expectedOutcome goldenFileBaseName = | ||
| H.withTests 1 $ H.withShrinks 0 $ H.property $ do | ||
| goldenFp <- H.Base.note $ addPrefix goldenFileBaseName | ||
| actualValue <- liftIO $ checkNodeTraceConfiguration goldenFp | ||
| actualValue H.=== expectedOutcome | ||
|
|
||
| data SubdirSelection = | ||
| InternalSubdir FilePath | ||
| | ExternalSubdir FilePath | ||
|
|
||
| -- | NB: this function is only used in 'goldenTestJSON' but it is defined at the | ||
| -- top level so that we can refer to it in the documentation of this module. | ||
| addPrefix :: FilePath -> FilePath | ||
| addPrefix fname = "test/Test/Cardano/Tracing/NewTracing/data/" <> fname | ||
| testSubdir, configSubdir :: SubdirSelection | ||
| testSubdir = InternalSubdir "test/Test/Cardano/Tracing/NewTracing/data" | ||
| configSubdir = ExternalSubdir $ "configuration" </> "cardano" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.