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

Add coverage support to verify command #518

Open
dudicoco opened this issue Apr 2, 2021 · 5 comments
Open

Add coverage support to verify command #518

dudicoco opened this issue Apr 2, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@dudicoco
Copy link

dudicoco commented Apr 2, 2021

Hi,

The opa test command has a --coverage flag which outputs the tests coverage.

Can this be added to conftest verify?

It would be great if it would be possible to make it exit with exit code 1 if coverage is not 100.

Thanks

@jpreese jpreese added the enhancement New feature or request label Apr 9, 2021
@jpreese
Copy link
Member

jpreese commented Apr 14, 2021

Not opposed to the idea of returning a non-zero error code based on coverage, but would lean more towards something along the lines of:

conftest verify ... --coverage=80

Where 80 represents the minimum percentage

NOTE: OPA binary exposes --coverage to enable coverage output (which also disables tracing) and also exposes a --threshold flag to set it. May be worth using this approach to keep synergy with the OPA binary.

@dudicoco
Copy link
Author

@jpreese I did write in my first post that the opa test command has a --coverage flag, perhaps you missed it. :)

When do you think this feature could be added to conftest as well?

@jpreese
Copy link
Member

jpreese commented Apr 22, 2021

Yep! I saw it, just leaving a note that they split coverage and threshold into two different flags, rather than just a single one.

At the moment, I don't have a timeline just whenever someone opens a pull request 😄

@dudicoco
Copy link
Author

Thanks @jpreese.

Not a big deal, for now i'm using the opa binary for unit tests + coverage check.

@delamart
Copy link

Opa doesn't have the parse_config or parse_config_file functions so I can't do coverage when I use thoses.

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
None yet
Development

No branches or pull requests

3 participants