I’m just finally trying out ChefDK for the first time and when running unit
tests on one of my cookbooks I notice warnings like the following:
.[2015-01-29T14:47:55-06:00] WARN: The on_platforms option to node_map has
When I tracked this message down to coming from ‘node_map.rb’ in the chef
gem, I noticed it was from Chef 12.
That got me to thinking – how am I supposed to define the Chef version I
want my unit tests to run against? I just assumed they would run against
the Chef version dictated by the ChefDK version I was using (0.3.4 in this
case to target Chef 11.16.4).
And more generally, how exactly am I supposed to run the tests?
At first I simply ran ‘chef exec rspec’ (or chef shell-init and then just
I guess first question is, is that how I am supposed to run them?
I was able to control the Chef version by specifying it in my Gemfile and
running ‘chef exec bundle update’ and ‘chef exec bundle exec rspec’, but
I’m not sure I am really supposed to be doing that?
Any guidance would be appreciated!