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

fga model test --verbose output should be easy to parse #385

Open
jmickeyd opened this issue Sep 5, 2024 · 2 comments
Open

fga model test --verbose output should be easy to parse #385

jmickeyd opened this issue Sep 5, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@jmickeyd
Copy link

jmickeyd commented Sep 5, 2024

Currently when running tests with the --verbose flag, a nicely parsable json is immediately followed by the plain text summary, making the whole thing harder to parse.

Example:

$ fga model test --verbose --tests tests.fga.yaml | jq .
[ json blob ... ]
jq: parse error: Invalid numeric literal at line 2, column 2

Either one of the blobs should be send to stderr, the pretty print text should be suppressed, or at a minimum, a flag be added to optionally suppress the pretty print.

@jmickeyd
Copy link
Author

jmickeyd commented Sep 5, 2024

I'm willing to send a patch, it should be trivially small, but I'm not sure what you consider a breaking change for things like this. I.e. is the last option (adding a new flag) the preferable one?

@jmickeyd
Copy link
Author

jmickeyd commented Sep 5, 2024

Actually, it looks like due to an effort to set the exit code correctly, the pretty print is already suppressed when there are test failures,

cli/cmd/model/test.go

Lines 77 to 79 in 36091f0

if !passing {
os.Exit(1)
}

@rhamzeh rhamzeh added the enhancement New feature or request label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants