On May 20, 2011, at 8:36 AM, Nigel Kersten wrote:

> So it turns out that we've never actually had failed pre/post commands cause 
> runs to fail, even though the tests appear to be testing the right thing.
> 
>       it "should fail if the command fails" do
>         Puppet.settings[:prerun_command] = "/my/command"
>         Puppet::Util.expects(:execute).raises Puppet::ExecutionFailure
>   
>         lambda { @agent.execute_prerun_command }.should 
> raise_error(Puppet::Configurer::CommandHookError)
>       end
>     end
> 
> We do actually raise that error. We just happen to rescue it as well, and 
> continue on.
> 
> I have a patch to resolve this, but I'm unsure what we should actually be 
> testing to ensure this problem doesn't crop up in the future. Should I be 
> checking the report status instead?


It looks like we actually have a logic bug in Configurer#run - it's logging on 
errors in prepare(), but not failing on them, which it really should do.

You should probably be testing that Configurer#run raises the exception, rather 
than catches it.

-- 
I have never met a man so ignorant that I couldn't learn something
from him.      --Galileo Galilei
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   http://about.me/lak



-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to