Skip to content

Commit

Permalink
More tweaks to visibility thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Aug 22, 2024
1 parent 569cf1f commit cba2f10
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions sandwich-contexts/lib/Test/Sandwich/Contexts/Files.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ module Test.Sandwich.Contexts.Nix (
, HasNixEnvironment

, NixpkgsDerivation(..)

, defaultFileContextVisibilityThreshold
) where

import Control.Monad.Catch (MonadMask, MonadThrow)
Expand Down Expand Up @@ -74,6 +76,8 @@ nixEnvironment = Label

type HasNixEnvironment context = HasLabel context "nixEnvironment" FilePath

defaultFileContextVisibilityThreshold :: Int
defaultFileContextVisibilityThreshold = 150

data NixpkgsDerivation =
NixpkgsDerivationFetchFromGitHub {
Expand Down Expand Up @@ -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' :: (
Expand Down Expand Up @@ -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' :: (
Expand Down
2 changes: 1 addition & 1 deletion sandwich/src/Test/Sandwich/Types/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -775,4 +775,4 @@ alterTopLevelNodeOptions g (Free x) = Free (x { nodeOptions = g (nodeOptions x)
alterTopLevelNodeOptions _ x@(Pure _) = x

systemVisibilityThreshold :: Int
systemVisibilityThreshold = 150
systemVisibilityThreshold = 200

0 comments on commit cba2f10

Please sign in to comment.