Oh, that was easier than expected: rspec-puppet does not provide a default
set of facts to your tests. Without any facts, puppet assumes your "host"
OS as test environment. Since your test is targeting a Linux machine, when
running the tests on Windows, this assumption is wrong.

To fix, use rspec-puppet-facts
<https://github.com/mcanevet/rspec-puppet-facts> in your tests to provide
prefab fact sets to your tests. The pdk ships a copy, but you'll have to
add it to your Gemfile (or use the Gemfile from the pdk-module-template
(e.g. copying over from a `pdk new module` run). PDK-428
<https://tickets.puppetlabs.com/browse/PDK-428> will make that easier, soon.

https://github.com/puppetlabs/pdk-module-template/blob/master/object_templates/class_spec.erb
is the default class test, and the rspec-puppet-facts README has more
explanations.


Cheers, David


On 17 August 2017 at 16:14, Peter Faller <[email protected]> wrote:

> Hi David
>
> Reduced example manifest and test attached ...
>
> On Linux:
>
> [root@tstpuppet01 rimcdm]# rspec spec/defines/test_reduced_spec.rb
> .
>
> Finished in 0.79952 seconds (files took 2.66 seconds to load)
> 1 example, 0 failures
>
> On Windows:
>
> PS rimcdm> pdk bundle exec -- rspec .\spec\defines\test_reduced_spec.rb
> F
>
> Failures:
>
>   1) rimcdm::test_reduced Create Test environment should compile into a
> catalogue without dependency cycles
>      Failure/Error: is_expected.to compile
>        error during compilation: Parameter path failed on
> File[/var/lib/tftpboot]: File paths must be fully qualified, n
> ot '/var/lib/tftpboot' at line 3
>      # ./spec/defines/test_reduced_spec.rb:18:in `block (3 levels) in
> <top (required)>'
>
> Finished in 8.33 seconds (files took 2.02 seconds to load)
> 1 example, 1 failure
>
> Failed examples:
>
> rspec ./spec/defines/test_reduced_spec.rb:17 # rimcdm::test_reduced
> Create Test environment should compile into a catalo
> gue without dependency cycles
>
>
> On Thursday, 17 August 2017 15:32:49 UTC+2, David Schmitt wrote:
>>
>> ...
>>
> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/8fad49d4-5efd-44c2-b3c0-49627c21d329%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/8fad49d4-5efd-44c2-b3c0-49627c21d329%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CALF7fHaJWpGNVNy3%2BTFAKN32aKMT2Lkm726Ywh9fjP1WQwu9Jw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to