On Sunday, April 27, 2014 9:38:52 AM UTC-5, Remi Ferrand wrote: > > Hi everyone, > > thanks all for your answers but i'm starting to think that there is way to > pass puppet "undef" value from a rspec test... > If anybody has the solution to fix this test suite ( > https://github.com/riton/puppetrspec) please tell me; otherwise I'll have > to rewrite my manifests and replace the puppet "undef" value with a simple > "undef" string where it is possible... > > It doesn't have the same meaning but it can help me moving on with my test > suite. > >
I've been watching this thread with interest because people were offering actual approaches to do something that I would not have thought was possible. I'll be a bit disappointed if it indeed turns out that it really isn't possible. To the best of my knowledge, however, Puppet never passes undef as the value of a class or resource parameter. At least, if you assign undef to a class or resource parameter in the DSL, then that does not mean the parameter should take that value; rather, it is an affirmative expression of not assigning any value at all. As a result, the parameter takes the default value defined for it, if there is any. (That's most often useful in the form of an override.) If you could use rspec to assign undef as a class or resource parameter, then what would that actually test? Not any defined behavior of your class or type. If it is Puppet's DSL evaluator that strips undef-valued parameters, then bypassing that via rspec -- if you can -- must yield undefined behavior. On the other hand, if it is a general feature of Puppet's infrastructure for types that strips undef-valued parameters, then sending undef via rspec tests that feature, not anything your type can do. I would have thought that the way to test what your type does when one of its parameter is declared undef would be simply to avoid specifying that parameter to it. John -- 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/0467cb05-4125-4760-8fa7-48bebdfc8dd8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.