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

zkg install does not run tests for dependencies #192

Open
bbannier opened this issue May 29, 2024 · 0 comments
Open

zkg install does not run tests for dependencies #192

bbannier opened this issue May 29, 2024 · 0 comments

Comments

@bbannier
Copy link
Contributor

bbannier commented May 29, 2024

When installing a package zkg by default runs the unit tests of the package, and not running unit tests requires explicit opt-out via --skiptests. We use this behavior e.g., to run tests against analyzers in CI.

If a package pulls in others via depends however the tests of the dependencies are not run. I am not sure whether this is by (undocumented) design, or by accident, but it definitely was gotcha moment for me since it deviated from my expectations ("zkg surely runs tests for every install"). The current zkg install docs are at least ambiguous here in how they talk of unit tests for packages,

  --skiptests          Skip running unit tests for packages before installation. (default: False)

This e.g., tripped me up with https://github.com/zeek/spicy-analyzers which is a metapackage without its own tests which just aggregates other packages. There currently seems no way to run the tests of the dependencies directly zkg: zkg test bails since the package has no tests, zkg install does not allow running tests of dependencies. Instead one would have to explicitly query the dependencies and test them manually, e.g., this kind of gymnastics

$ zkg info --json spicy-analyzers |
        jq -r 'to_entries | .[] | select(.key|contains("spicy-analyzers")) | .value.metadata[].depends | to_entries | .[].key' | 
        xargs -n1 zkg test 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant