We try hard to use rspec-puppet in effective ways, but you may still see
some over-testing in the supported modules nonetheless :).

We use rspec-puppet to test that:

1. Manifests compile and templates parse (catches a lot of problems)
2. Conditional logic in manifests follows the expected paths for given
inputs (various facts of operatingsystems [4], or various expected
parameter values)
3. Conditional logic in templates actually creates config files as expected
(make sure to have "negative" tests that throw false/undef in for
validation to avoid blank entries)
4. And recently started testing "future parser" and "strict variables" on
our modules (as of puppetlabs_spec_helper 0.6.0).

But what does rspec-puppet not do?

rspec-puppet will obviously NOT indicate when a configuration file's syntax
cannot be understood by the actual service (apache [2], haproxy, sudoers,
etc), that your package names are really correct (mongodb just changed all
of their upstream package names [3]), or when command output from the
system changes with versions (git 1.7 vs 1.9 in vcsrepo) but for those
cases a few beaker-rspec [1] tests should give you extra assurances after
you get rspec-puppet doing the most critical parts. (beaker-rspec is much
slower than rspec-puppet, so we try to limit its use).

[1] https://github.com/puppetlabs/beaker-rspec/
[2]
https://github.com/puppetlabs/puppetlabs-apache/blob/1.1.0/spec/acceptance/mod_php_spec.rb#L56-L96
Example of verifying that php actually works
[3]
https://github.com/puppetlabs/puppetlabs-mongodb/blob/0.8.0/spec/acceptance/server_spec.rb#L45-L58
Example of verifying that packages actually install
[4] https://github.com/apenney/pe_fixtures is an example of a collection of
facts to choose from



-Hunter


On Thu, Jul 10, 2014 at 5:29 PM, Ben Sullivan <bensulli...@bensullivan.net>
wrote:

> Hi
>
> I'm looking for some reference modules to share with my team to illustrate
> how to best use rspec-puppet to unit test Puppet DSL code.
>
> I'm going to go through the Puppet Enterprise supported modules as I
> figured that was a reasonable place to start:
> https://forge.puppetlabs.com/modules?supported=yes
>
> The team doesn't understand the value of rspec-puppet at present and I
> need to articulate arguments to get some buy-in.  At the moment we rely on
> long-running end to end tests which won't scale for us as our automation
> codebase grows.
>
> Any tips/recommendations would be appreciated.
>
> Many thanks
>
> Ben
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/36fe87b2-4430-4ab1-8f55-d4d93572942d%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/36fe87b2-4430-4ab1-8f55-d4d93572942d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAJaQvGBEGedUcv2FZnih5HrdO7L-%2BGvPu4g3VW2ujHrQ2gNkGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to