Update readonly-paths-from-var test case
In 8fa6d132e1, ~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.
This commit is contained in:
parent
b0a8a22983
commit
dffe5d150c
1 changed files with 10 additions and 4 deletions
|
|
@ -160,7 +160,7 @@ spec = parallel $ inTestM $ do
|
||||||
|]
|
|]
|
||||||
liftIO $ doesFileExist (tmpDir </> "fake-browser") `shouldReturn` False
|
liftIO $ doesFileExist (tmpDir </> "fake-browser") `shouldReturn` False
|
||||||
|
|
||||||
describe "readonly-from-path-var" $ do
|
describe "readonly-paths-from-var" $ do
|
||||||
forM_ [":", " "] $ \separator ->
|
forM_ [":", " "] $ \separator ->
|
||||||
describe ("with separator \"" <> separator <> "\"") $ do
|
describe ("with separator \"" <> separator <> "\"") $ do
|
||||||
it "binds all paths in the specified environment variable as read only" $ 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") ""
|
let mkTestPath path = liftIO $ createDirectoryIfMissing True (tmpDir </> path) >> writeFile (tmpDir </> path </> "file") ""
|
||||||
mkTestPath "some/path"
|
mkTestPath "some/path"
|
||||||
mkTestPath "some/other/path"
|
mkTestPath "some/other/path"
|
||||||
|
mkTestPath "some/final/real/path"
|
||||||
mkTestPath "some/not/in/var"
|
mkTestPath "some/not/in/var"
|
||||||
let testPaths =
|
let testPaths =
|
||||||
intercalate
|
intercalate
|
||||||
|
|
@ -176,9 +177,10 @@ spec = parallel $ inTestM $ do
|
||||||
$ map
|
$ map
|
||||||
(tmpDir </>)
|
(tmpDir </>)
|
||||||
[ "some/path",
|
[ "some/path",
|
||||||
"some/non/existant/path",
|
"some/non/existent/path",
|
||||||
"some/other/path",
|
"some/other/path",
|
||||||
"some/other/non/existant/path"
|
"some/other/non/existent/path",
|
||||||
|
"some/final/real/path"
|
||||||
]
|
]
|
||||||
withEnv "TEST_PATHS" testPaths $ do
|
withEnv "TEST_PATHS" testPaths $ do
|
||||||
[i|
|
[i|
|
||||||
|
|
@ -189,13 +191,17 @@ spec = parallel $ inTestM $ do
|
||||||
`shouldOutput` unindent
|
`shouldOutput` unindent
|
||||||
[i|
|
[i|
|
||||||
#{tmpDir </> "some"}
|
#{tmpDir </> "some"}
|
||||||
|
|-- final
|
||||||
|
| `-- real
|
||||||
|
| `-- path
|
||||||
|
| `-- file
|
||||||
|-- other
|
|-- other
|
||||||
| `-- path
|
| `-- path
|
||||||
| `-- file
|
| `-- file
|
||||||
`-- path
|
`-- path
|
||||||
`-- file
|
`-- file
|
||||||
|
|
||||||
4 directories, 2 files
|
7 directories, 3 files
|
||||||
|]
|
|]
|
||||||
|
|
||||||
it "doesn't require the var to be set" $ do
|
it "doesn't require the var to be set" $ do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue