From cba2f10585d1894b16ceb7c86b23909dc644dcd0 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Wed, 21 Aug 2024 21:26:11 -0700 Subject: [PATCH] More tweaks to visibility thresholds --- sandwich-contexts/lib/Test/Sandwich/Contexts/Files.hs | 3 --- sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs | 8 ++++++-- sandwich/src/Test/Sandwich/Types/Spec.hs | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sandwich-contexts/lib/Test/Sandwich/Contexts/Files.hs b/sandwich-contexts/lib/Test/Sandwich/Contexts/Files.hs index 9f37f96a..86a47765 100644 --- a/sandwich-contexts/lib/Test/Sandwich/Contexts/Files.hs +++ b/sandwich-contexts/lib/Test/Sandwich/Contexts/Files.hs @@ -89,9 +89,6 @@ import Test.Sandwich.Contexts.Nix import UnliftIO.Directory -defaultFileContextVisibilityThreshold :: Int -defaultFileContextVisibilityThreshold = 150 - -- | A file path to make available to tests. -- For example, this can be an external binary like "minikube" if a given test context wants -- to use it to start a Minikube cluster. diff --git a/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs b/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs index 0c0222eb..3e4b0c74 100644 --- a/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs +++ b/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs @@ -31,6 +31,8 @@ module Test.Sandwich.Contexts.Nix ( , HasNixEnvironment , NixpkgsDerivation(..) + + , defaultFileContextVisibilityThreshold ) where import Control.Monad.Catch (MonadMask, MonadThrow) @@ -74,6 +76,8 @@ nixEnvironment = Label type HasNixEnvironment context = HasLabel context "nixEnvironment" FilePath +defaultFileContextVisibilityThreshold :: Int +defaultFileContextVisibilityThreshold = 150 data NixpkgsDerivation = NixpkgsDerivationFetchFromGitHub { @@ -126,7 +130,7 @@ introduceNixContext :: ( -> SpecFree (LabelValue "nixContext" NixContext :> context) m () -- | Parent spec -> SpecFree context m () -introduceNixContext = introduceNixContext' (defaultNodeOptions { nodeOptionsVisibilityThreshold = 100 }) +introduceNixContext = introduceNixContext' (defaultNodeOptions { nodeOptionsVisibilityThreshold = defaultFileContextVisibilityThreshold }) -- | Same as 'introduceNixContext', but allows passing custom 'NodeOptions'. introduceNixContext' :: ( @@ -160,7 +164,7 @@ introduceNixEnvironment :: ( => [Text] -> SpecFree (LabelValue "nixEnvironment" FilePath :> context) m () -> SpecFree context m () -introduceNixEnvironment = introduceNixEnvironment' (defaultNodeOptions { nodeOptionsVisibilityThreshold = 100 }) +introduceNixEnvironment = introduceNixEnvironment' (defaultNodeOptions { nodeOptionsVisibilityThreshold = defaultFileContextVisibilityThreshold }) -- | Same as 'introduceNixEnvironment', but allows passing custom 'NodeOptions'. introduceNixEnvironment' :: ( diff --git a/sandwich/src/Test/Sandwich/Types/Spec.hs b/sandwich/src/Test/Sandwich/Types/Spec.hs index c7c9f976..5d250680 100644 --- a/sandwich/src/Test/Sandwich/Types/Spec.hs +++ b/sandwich/src/Test/Sandwich/Types/Spec.hs @@ -775,4 +775,4 @@ alterTopLevelNodeOptions g (Free x) = Free (x { nodeOptions = g (nodeOptions x) alterTopLevelNodeOptions _ x@(Pure _) = x systemVisibilityThreshold :: Int -systemVisibilityThreshold = 150 +systemVisibilityThreshold = 200