Hi Erik, *!
 

> > Is there something equivalent in puppetlabs_spec_helper that works for 
>>> > v4 API functions? 
>>> > 
>>> There is an updated version of puppet-rspec that will help with this. (I 
>>> heard about this yesterday). Hunner knows more. 
>>>
>>
>> rspec-puppet 2.1.0 should have all that work. There are a few more 
>> patches and bug fixes in the pipeline, but 2.1.0 should already get you far.
>>
>> Some examples of rspec-puppet only function testing can be found in the 
>> upcoming refresh of stdlib's function specs, currently in my WIP branch 
>> here:
>>
>>
>> https://github.com/DavidS/puppetlabs-stdlib/commits/modules-1882-rspec-puppet-migration
>>
>>
>>
> It seems like you only have one function using the v4 API (type_of), and 
> the unit test for that is only run on Puppet 4.0, but the travis matrix 
> doesn't specify puppet 4.0 at all. So the test for that doesn't run. Does 
> it work if you try it locally with Puppet 4.0?
>
>
> To demonstrate the issue I created a minimal test module (
> https://github.com/dalen/puppet-v4functiontest), and it still doesn't 
> work with rspec-puppet 2.1.0: 
> https://travis-ci.org/dalen/puppet-v4functiontest/builds/60517933
>
> Do you have any idea what is wrong with that code?
>

Yeah, I've now finally found out what is wrong with this. Puppet4 requires 
the `environment path` setting to find the code. spec-puppet's own test 
suite sets this, but it does not setup projects with this setting. I've 
submitted a PR to fix this. module projects will have to update this 
manually.

rspec-puppet PR: https://github.com/rodjek/rspec-puppet/pull/288
fixed code in your test module I've used for 
debugging: 
https://github.com/DavidS/puppet-v4functiontest/tree/update-rspec-infra

Cheers, David

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/e2dd083a-3171-40dc-9510-cde40ba938a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to