From dffe5d150cc00ace383758a251d266798c50c231 Mon Sep 17 00:00:00 2001 From: Alex David Date: Fri, 10 Oct 2025 16:39:21 -0700 Subject: [PATCH] Update readonly-paths-from-var test case In 8fa6d132e16f03b9d1997fe6d446634c104f5485, ~mathiassven submitted a patch that fixes the `readonly-paths-from-var` combinator omitting the final path. The tests didn't catch this since the final path in the test was a non-existent path. This commit backfills the test to catch regressions related to this bug. The test now makes sure that the first, last, and at least one middle test path are real paths that show up in the jail. --- tests/spec/CombinatorsSpec.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/spec/CombinatorsSpec.hs b/tests/spec/CombinatorsSpec.hs index 9b12eb1..2667dc0 100644 --- a/tests/spec/CombinatorsSpec.hs +++ b/tests/spec/CombinatorsSpec.hs @@ -160,7 +160,7 @@ spec = parallel $ inTestM $ do |] liftIO $ doesFileExist (tmpDir "fake-browser") `shouldReturn` False - describe "readonly-from-path-var" $ do + describe "readonly-paths-from-var" $ do forM_ [":", " "] $ \separator -> describe ("with separator \"" <> separator <> "\"") $ do it "binds all paths in the specified environment variable as read only" $ do @@ -169,6 +169,7 @@ spec = parallel $ inTestM $ do let mkTestPath path = liftIO $ createDirectoryIfMissing True (tmpDir path) >> writeFile (tmpDir path "file") "" mkTestPath "some/path" mkTestPath "some/other/path" + mkTestPath "some/final/real/path" mkTestPath "some/not/in/var" let testPaths = intercalate @@ -176,9 +177,10 @@ spec = parallel $ inTestM $ do $ map (tmpDir ) [ "some/path", - "some/non/existant/path", + "some/non/existent/path", "some/other/path", - "some/other/non/existant/path" + "some/other/non/existent/path", + "some/final/real/path" ] withEnv "TEST_PATHS" testPaths $ do [i| @@ -189,13 +191,17 @@ spec = parallel $ inTestM $ do `shouldOutput` unindent [i| #{tmpDir "some"} + |-- final + | `-- real + | `-- path + | `-- file |-- other | `-- path | `-- file `-- path `-- file - 4 directories, 2 files + 7 directories, 3 files |] it "doesn't require the var to be set" $ do