[chef] Re: Testing templates with mock node attributes


Chronological Thread 
  • From: "Scott M. Likens" < >
  • To:
  • Subject: [chef] Re: Testing templates with mock node attributes
  • Date: Fri, 26 Apr 2013 11:37:50 -0700

Carlton,

You can specify attributes for a test scenario in .kitchen.yml if you are using test-kitchen.  Review https://github.com/opscode/test-kitchen/blob/1.0/README.md and scan down to The Kitchen YAML Format.  chef-rvm uses attributes so it maybe worth a review.  https://github.com/fnichol/chef-rvm

Hope that helps

Scott
On 4/26/13 11:32 AM, Carlton Stedman wrote:
" type="cite">
Ohai, Chefs,

I have been trying to use a test-driven development method for baking Chef recipes and have been having good success with chefspec and minitest-chef-handler. However, one area that currently is difficult to test are templates.

I am looking for a way to get the output of erb templates, correctly substituting in node attributes (e.g. have a <%= node[:something] %> and want to get it to substitute correctly). So far, I haven't found a solution.

I was wondering if anyone has a solution to this?

Otherwise, I am considering working on one, perhaps using Fauxhai to mock for node attribute substitution.

Thanks a lot,
Carlton
!DSPAM:517ac843209751804284693!




Archive powered by MHonArc 2.6.16.

§