Closed bittner closed 7 years ago
Looks like there is a STRICT_VARIABLES
environment variable that can be set to make the tests pass, according to the puppetlabs_spec_helper README:
$ STRICT_VARIABLES=no pdk test unit
Any better solution suggested?
@bittner That's a custom fact that the PDK doesn't know about. See https://github.com/joshuabaird/puppet-ipaclient/blob/052dd074420b6a2a494e86b2c03020be57940205/lib/facter/ipa_facts.rb#L22
You'll have to add it in to your spec test just like you would $osfamily
or the like. Don't disable variable validation :)
@binford2k Thanks for the hint! This makes sense. I'll go with the rspec-puppet-facts docs on adding custom facts.
Now comes the tricky part: Figuring out which values to pick. :smirk:
I'm testing the roles of our control repo, and with profiles that include
ipaclient
I get anEvaluation Error: Unknown variable:
for all$::ipa_*
variables.Clearly, they are not defined (e.g. in params.pp), as this happens via facter/ipa_facts.pp.
... which comes from init.pp, line 117.
Do I have to configure the tests via
.fixtures.yml
in some way, or is there some other way to make facter (andipa_facts.rb
) initialize those values when running the test suite?