Skip to content

Clarify or improve globbing support for fga model test #605

@ewanharris

Description

@ewanharris

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 (golang/go#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.yaml resolves both the basic-store.fga.yaml and relative-path/relative-path-store.fga.yaml
  • fga model test --tests "./tests/fixtures/**/*.fga.yaml" will only resolve relative-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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Intake

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions