[chef] Re: Testing and chef best practices


Chronological Thread 
  • From: Yoshi Spendiff < >
  • To: chef < >
  • Subject: [chef] Re: Testing and chef best practices
  • Date: Tue, 16 Jun 2015 08:06:45 -0700

1. Parameterise it if it's something that would need changing. If it's a service for something specific and that service usually has a well known name then don't parameterise it
2. If you use parameters then set them as attributes in an attribute file in your cookbook, i.e.
     default['mycookbook']['service_name'] = 'myservice'
     default['mycookbook']['service_port'] = 1234
3. If this is a cookbook that you intend to release to the community then I would write both unit and integration tests. It's a lot quicker to run a chefspec suite (especially if you use caching instead of let) than full integration tests, so you can run those while you're developing to quickly see if you've introduced a problem and then move up to integration tests once those pass

On Mon, Jun 15, 2015 at 8:22 PM, Sean Farrow < " target="_blank"> > wrote:

Hi,

 

I am writing a recipe that cretes a windows service. Is it better to have a hard-coded service name or parameterize this in some way? I the latter, what method is better, databags or is ther something else?

Also should I write a unit test using ChefSpec for this or is just an integration test sufficient?

What are people’s testing preferences around uses of third-party cookbooks?

Kind regards

Sean.




--
Yoshi Spendiff
Ops Engineer
Indochino
Mobile: +1 778 952 2025



Archive powered by MHonArc 2.6.16.

§