juspay / juspay/fencer

Fix, test, and document behavior for configuration loading

Open
#26 16 comments 0 reactions 2 assignees Claimed by @mdimjasevic View on GitHub
in progress
Dominant language
Haskell
Stars
9
Forks
4
PR merge metrics
No merged PRs in 30d

Description

- [x] What happens if at startup, one rule (out of several) in one domain (out of several) can't be parsed?
- [x] Same, but during config reloading, not during startup.
- [x] What happens when configuration contains duplicate domains?
- [x] What happens when a domain contains duplicate rules?
- [x] What happens with YAML files containing [several documents](https://gettaurus.org/docs/YAMLTutorial/#YAML-Multi-Documents)?
- [x] What is the minimal accepted configuration file? Is it the same for Fencer and for lyft/ratelimit?

Also:

- [x] (done in #46, not documented) Turns out that lyft/ratelimit loads all files, not just `.yml` files.
- [x] (done in #46, not documented) And it loads them recursively.
- [x] Would it look at `.foo/bar.yaml` if `RUNTIME_IGNOREDOTFILES` is enabled?
- [x] `RUNTIME_IGNOREDOTFILES` in general is not tested by our testsuite by our testsuite, but should be.

Also:

- [x] When lyft/ratelimit finds no configs in the dir, it responds to requests with OK.
- [x] When lyft/ratelimit doesn't find the dir symlink, it responds to requests with OK.
- [x] (partly done in #35, not tested properly, not documented) When lyft/ratelimit finds the config dir but even one file is corrupted (broken YAML or correct YAML but broken field names), it responds to requests with ERROR.
- [x] When lyft/ratelimit can't read a file (e.g. `chmod 0`-ed), other files are loaded correctly and it responds to requests with OK.

And more:

- [ ] Q: What happens to symlinks to files outside the config dir?
A: I checked and they are loaded just fine.
- [ ] Q: Symlinks to directories outside the config dir?
A: They are not followed.
- [ ] Q: Symlink cycles?
A: They are detected ("Too many levels of symbolic links") and other files are loaded correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.