Closed newtonne closed 3 years ago
In many cases rspec-puppet is used to verify modules for use by others. In this case the module needs to work on the strictest settings, since it has no control over other's environments who'd possibly be running with strict_variables on. Hence the default.
To address this for folks like yourself, we added the possibility to override this setting through the .sync.yml in the pdk-templates in https://github.com/puppetlabs/pdk-templates/pull/326.
Please follow the official docs for upgrading to puppet4/5 and the Updating 3->4 Manifests guide. Also understand that puppet5 is EOL this January, so don't stop updating until you're at puppet7. The updates from 5 through 7 will be a lot smoother, as there are no major changes like from 3 to 4.
Thanks, @DavidS. Indeed, as mentioned in the PR you linked, that line in puppetlabs_spec_helper/module_spec_helper.rb
confuses things somewhat.
Also, I'm sure you'll be pleased to learn that we have already upgraded through to Puppet 6 👍
We're finally(!) migrating our infrastructure from Puppet 3 to Puppet 4 and in preparation for this, we have started testing all our modules against the latest Puppet 4 version, 4.10.12.
We found that many of our tests that were passing against Puppet 3.8.7, now failed against Puppet 4.10.12 with errors similar to the following:
By the way, we are using the same rspec-puppet version for Puppet 3 and Puppet 4 testing:
It seemed to me that something was setting strict_variables to true, and so to test this theory, I ran the tests as:
and indeed they passed.
However, when I configured the spec_helper config option instead:
the tests did not pass. What's more, the documentation suggests that this setting defaults to false anyway.
I then tried configuring strict_variables using Puppet.settings:
which caused the tests to pass once more.
So a couple of questions:
Thanks.