I agree with the other comments, start with RSpec, where you can easily 
mock things, then move on to acceptance testing. The reason you cannot 
easily mock things with acceptance testing is that currently Beaker is 
executing Puppet Apply on a piece of code and then using Serverspec to 
check over the status of the server afterwards by running commands over 
SSH. It does not actually have access to the compiled catalog in Ruby like 
RSpec testing does. As a result it's very hard to tell it to ignore a 
failure of a certain resource.

You could always comment it out for your acceptance tests, not ideal though.

On Tuesday, 20 October 2015 18:49:13 UTC+11, Alex Harvey wrote:
>
> Hi all,
>
> I am investigating whether or not I can use Beaker to do acceptance 
> testing on roles and profiles. 
>
> I've had a look at Liam Bennett's excellent blog posts -
>
> http://tech.opentable.co.uk/blog/2014/09/01/testing-puppet-with-beaker-pt-dot-3-testing-roles/
> http://www.slideshare.net/liamjbennett/cfgmgmt2015-testing-with-beaker
>
> I need to handle a situation in my tests where, say, a role that I am 
> testing will apply a base class which will cause the node, for instance, to 
> join a FreeIPA domain.  But I don't want Beaker to actually build a FreeIPA 
> box.  And I don't want my short-lived node to join a real FreeIPA domain.  
>
> I would hope that Beaker could either build Mock Services
> https://en.wikipedia.org/wiki/Mock_object
>
> Or better still, tell Beaker to expect the base class to try to apply the 
> FreeIPA class, and just pretend it succeeds.  Just as you can stub out 
> methods in rspec etc.
>
> Has anyone done anything like this before?
>
> Kind regards,
> Alex Harvey
>

-- 
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/0cfb8ee5-a43a-41e4-96fc-9e0f83f5ba16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to