Skip to content
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

Test the RUNTIME_IGNOREDOTFILES environment variable #78

Merged
merged 16 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Fencer-specific environment variables are:
- `RUNTIME_IGNOREDOTFILES` - A flag indicating whether to ignore files
with names starting with a dot (hidden files on Linux-based systems
and macOS). It can be `True` or `False`. The default value is
`False`.
`False`. Directories with names starting in a dot are not ignored.
mdimjasevic marked this conversation as resolved.
Show resolved Hide resolved
- `GRPC_PORT` - The port to run the gRPC server on. Default is 8081.

## Developing
Expand Down
28 changes: 27 additions & 1 deletion test/Fencer/Rules/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ tests = testGroup "Rule tests"
, test_rulesLoadRulesNonYaml
, test_rulesLoadRulesRecursively
, test_rulesLoadRulesDotDirectory
, test_rulesLoadRules_ignoreDotFiles
, test_rulesLoadRules_dontIgnoreDotFiles
]

-- | Create given directory structure and check that 'loadRulesFromDirectory'
Expand Down Expand Up @@ -71,7 +73,7 @@ test_rulesLoadRulesYaml =
-- dot-directory when dot-files should be ignored.
test_rulesLoadRulesDotDirectory :: TestTree
test_rulesLoadRulesDotDirectory =
testCase "Rules are loaded from a dot-directory" $
testCase "Rules are not loaded from a dot-directory" $
expectLoadRules
(#ignoreDotFiles True)
(#files
Expand All @@ -80,6 +82,30 @@ test_rulesLoadRulesDotDirectory =
)
(#result [domain2])

-- | test that 'loadRulesFromDirectory' ignores dot-files.
test_rulesLoadRules_ignoreDotFiles :: TestTree
test_rulesLoadRules_ignoreDotFiles =
testCase "Rules are not loaded from a dot-file" $
expectLoadRules
(#ignoreDotFiles True)
(#files
[ ("config1.yml", domain1Text)
, ("dir" </> ".config2.yaml", domain2Text) ]
)
(#result [domain1])

-- | test that 'loadRulesFromDirectory' does not ignore dot files.
test_rulesLoadRules_dontIgnoreDotFiles :: TestTree
test_rulesLoadRules_dontIgnoreDotFiles =
testCase "Rules are loaded from a dot-file" $
expectLoadRules
(#ignoreDotFiles False)
(#files
[ ("config1.yml", domain1Text)
, ("dir" </> ".config2.yaml", domain2Text) ]
)
(#result [domain1, domain2])

-- | Test that 'loadRulesFromDirectory' loads rules from all files, not just
-- YAML files.
--
Expand Down