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

Improve opa test --verbose and --explain flag usage #2267

Merged

Conversation

patrick-east
Copy link
Contributor

@patrick-east patrick-east commented Apr 3, 2020

This is adding support for two features (related enough to group together in a single PR).

First up is making the opa test --explain flag automatically turn on verbose output. This should help for anyone who is trying to see a trace (by providing the flag) and then being surprised when no trace output is shown.

The second one is to make it so that the default trace output shown when only specifying -v/--verbose includes both "fail" and "note" events. This should help users more easily troubleshoot why tests failed without having to use --explain full and sifting through all of the output.

Closes: #2068
Closes: #2069

Rather than requiring both `--explain` and `--verbose`/`-v` a user
just needs to pass in `--explain` and verbose output will be enabled.

Fixes: open-policy-agent#2069
Signed-off-by: Patrick East <east.patrick@gmail.com>
The default value for `--explain` was used when `--verbose`/`-v` was
specified. Now if only a verbose flag is specified we will show both
"fails" and "notes", which is most likely what someone would want
when troubleshooting some test failure.

Fixes: open-policy-agent#2068
Signed-off-by: Patrick East <east.patrick@gmail.com>
@patrick-east patrick-east requested a review from tsandall April 3, 2020 23:51
@patrick-east patrick-east changed the title Opa test improvements Improve opa test --verbose and --explain flag usage Apr 3, 2020
Copy link
Member

@tsandall tsandall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This is a nice improvement.

@tsandall tsandall merged commit e3c6240 into open-policy-agent:master Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants