parallel_tests
to speed up your rspec-puppet and
want to generate coverage reports, you must configure it in an
after(:suite)
hook in spec/spec_helper.rb
as
documented above and not with any other method (like an at_exit
hook in a spec file).
rspec-puppet can generate a basic resource coverage report at the end of the
test run by the following to your spec/spec_helper.rb
file.
This checks which Puppet resources have been explicitly checked as part of the test run and outputs both a coverage percentage and a list of untouched resources.
parallel_tests
to speed up your rspec-puppet and
want to generate coverage reports, you must configure it in an
after(:suite)
hook in spec/spec_helper.rb
as
documented above and not with any other method (like an at_exit
hook in a spec file).
A desired code coverage percentage can be provided as an argument to
RSpec::Puppet::Coverage.report!
.
If this percentage is not achieved, a test failure will be raised.
Resources declared outside of the module being tested (i.e. resources added by module dependencies) are automatically excluded from the coverage report.
create_resources
, ensure_packages
etc) did not have
the required information in them to determine which manifest they came from and
so can not be excluded from the coverage report.
To exclude other resources from the coverage reports, for example to avoid anchor
s,
use the add_filter(type, title)
and add_filter_regex(type, regex)
methods: