-
Notifications
You must be signed in to change notification settings - Fork 202
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
Host-based test coverage does not exclude resources outside of module #700
Comments
Yes, this is intended behaviour as hosts are not associated with any specific module. Can you give me some more details around the host you're testing so that we can try to improve the situation for you? The first thought that comes to mind is maybe an Happy to hear any ideas you have :) |
So now that I've been thinking about this, I'm guessing we are not using host-based tests as intended (which is what every developer loves to hear lol.) Often for our internal modules, we add host-based tests to modules to test different commonly-used (at our company) global/environmental hiera settings. This is important for us because hiera is the only interface exposed for our end users to make changes. We've also been using host-based tests in modules to test that OS-based data-in-module hiera settings are working as expected. In other words, I'm guessing your intention is that host-based tests are for testing site manifests and/or roles. In that case, it makes sense that the coverage report includes all dependencies, etc. When testing hosts in a module, however, I don't think it ever makes sense. I don't care that I'm not covering some third-party's resources because that's the job of the respective third-party module.
I like this option better than the first. Another option I like would be a boolean toggle to include external dependencies in the coverage report or not. Of course, "only use host-based tests as intended" is also an acceptable answer :) Thanks for the great work! |
In http://rspec-puppet.com/documentation/coverage/#excluded-resources, it says:
When testing a host, it reports untouched resources that are in a dependent module. Is this intended behavior when testing hosts (i.e. does the documentation not apply for host-based tests)? If so, is there a work-around? I can filter the external resources with
add_filter
, but this is tedious with numerous resources and I can see it becoming a management nightmare.Possibly related to #490
Thanks
The text was updated successfully, but these errors were encountered: