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

Clarify that tests are run locally when specifying a model .fga.yaml + store-id #335

Open
aaguiarz opened this issue May 27, 2024 · 2 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@aaguiarz
Copy link
Member

When you run model test using a file that has a model and we specify the store-id, the store-id is ignored and tests are run locally on the CLI.

fga model test --tests store.fga.yaml --store-id 01HYX4FWK9P2VFRQ0YABYNQ447

I think that's the right behavior, but we should display a message clarifying it:

$ fga model test --tests store.fga.yaml --store-id 01HYX4FWK9P2VFRQ0YABYNQ447
Ignoring store-id parameter, running tests locally using model from store.fga.yaml

# Test Summary #
Tests 2/2 passing
Checks 4/4 passing

Note that if the fga.yaml file does NOT have a model, tests are run in the OpenFGA server.

@aaguiarz aaguiarz added good first issue Good for newcomers help wanted Extra attention is needed labels May 27, 2024
@yogendrav-flwls
Copy link

Might be better to have a flag explicitly stating if we are running locally rather than coupling the store id as such

@aaguiarz
Copy link
Member Author

@yogendrav-flwls thanks for the feedback!

If we had a parameter that forced running it in the server (e.g. --server), we'll need to either:

  • Ignore the model and the tuples in the .fga.yaml file, using the ones in the server, and add a warning about it
  • Write the model+tuples, which is not what you'd expect from a command that is called model test.

The behavior coul be to always run it locally by default and have a flag to run it in the server. If the flag is specified we ignore the model/tuples. If store-id is specified without the flag, we'd return an error.

Something like:

$ fga model test --tests store.fga.yaml --store-id 01HYX4FWK9P2VFRQ0YABYNQ447
Please specify the --server option to run the tests on the FGA server

$ fga model test --tests store.fga.yaml --store-id 01HYX4FWK9P2VFRQ0YABYNQ447 --server
Ignoring model + tuples, running tests on the FGA server 

# Test Summary #
Tests 2/2 passing
Checks 4/4 passing

Would that make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
Status: Ready
Development

No branches or pull requests

3 participants