I'm running some rspec-puppet tests against a Puppet class that uses the `$facts` hash to retrieve a fact and set it to a local variable. The line in question looks like:
$noop_config = $facts["weblogic_${domain_name}_has_running_servers"]
The reason I need to use the `$facts` hash is because I'm interpolating a variable name to complete the fact name. I'm not sure if there's any other way to achieve this?
I'm attempting to set the fact in my spec tests like so:
let(:facts) { {
:kernel => 'Linux',
:weblogic_best_domain_ever_has_running_servers => true,
} }
When I run my rspec tests, I get the follow error (see below). I suspect it's because of some difference in the way Puppet manifests get compiled using rspec vs. a "normal" Puppet compilation.
facts is not a hash or array when accessing it with weblogic_best_domain_ever_has_running_servers
Has anyone had any experience using the `$facts` hash in combination with rspec-puppet tests?
↧