Clarify or improve globbing support for `fga model test`
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 102
- Forks
- 49
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 16
Description
The glob support for the --tests option in fga model test uses the Go filepath.Glob, which uses filepath.Match under the hood to match the glob pattern.
The means that we're missing support for ** in the glob pattern (https://github.com/golang/go/issues/11862) as the Go API is intended to mirror the C std lib rather than the bash globbing that some might expect.
** is especially useful as it would allow matching any number of path segments meaning that in a structure like in the test fixtures:
ls ./tests/fixtures/**/*.fga.yamlresolves both thebasic-store.fga.yamlandrelative-path/relative-path-store.fga.yamlfga model test --tests "./tests/fixtures/**/*.fga.yaml"will only resolverelative-path-store.fga.yaml
Given that it might be expected for the globbing to match the behaviour of bash, this might lead to folks accidentally not running their entire tests if they use a tool like ls to help determine the globbing pattern used.
We should either:
- Document this limitation
- Improve the globbing to match what is most likely expected
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the implementation of the --tests option in fga model test and compare its filepath.Glob behavior with the fixture patterns under tests/fixtures. Decide whether the intended outcome is documenting the ** limitation or supporting recursive matching, then verify the result against both basic-store.fga.yaml and relative-path/relative-path-store.fga.yaml.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100