[chef] Re: Re: RE: Unit Testing chef Cookbook


Chronological Thread 
  • From: Sachin Gupta < >
  • To:
  • Subject: [chef] Re: Re: RE: Unit Testing chef Cookbook
  • Date: Tue, 28 Oct 2014 16:43:24 +0530

Thanks Jeff for sharing useful info.

I will work more on ChefSpec. do you have any documentation link for chefSpec and Rspec.


Thanks & Regards,
Sachin Kumar

On Tue, Oct 28, 2014 at 4:37 PM, Jeff Byrnes < " target="_blank"> > wrote:
I wouldn’t necessarily call that testing, exactly, also, the `sudo` might be unnecessary in their environment (dangerous, even).

With regards to ChefSpec, that’s how we handle doing unit testing of our recipes. It’s fast (no convergence required), and lets you follow a TDD mentality (write your ChefSpec assertions first, then write your recipe).

On the other hand, integration tests are essential to determining that your cookbook actually did what you want it to do. For this, we utilize Test Kitchen, backed by either Vagrant or EC2, and Serverspec as our assertion library. This allows you to write tests, using Rspec syntax, that asset that the final result of your convergence has what you need (services are running, ports are being listened on, files exist & have certain content, etc.)

Between these two test libraries, we have grown in confidence regarding our cookbooks.

-- 
Jeff Byrnes
Operations Engineer

On October 28, 2014 at 5:17:20 AM, Malli Pulla Reddy ( " target="_blank"> ) wrote:

Hi,

 

sudo knife bootstrap <ipaddress> --sudo -x <username> -P <password> -r "recipe [your_cookbook_name]"

 

above command will do bootstrap and it will install cookbook.

 

Regards,

PullaReddy

From: Sachin Gupta [mailto: " target="_blank"> ]
Sent: Tuesday, October 28, 2014 2:15 PM
To: " target="_blank">
Cc: sachin kumar
Subject: [chef] Unit Testing chef Cookbook

 

Hi All,

I would like to know how to do unit testing of chef cookbooks. I have heard about chefSpec but not  very much familiar and used to ..

 

My team had developed few cookbooks and would like to know the code coverage,  etc.

Any help would be highly appreciated.

Thanks & Regards,
Sachin Gupta





Archive powered by MHonArc 2.6.16.

§