# Test-kitchen and multiple converges

**URL:** <https://discourse.chef.io/t/test-kitchen-and-multiple-converges/4594>\
**Category:** Chef Infra (archive)\
**Created:** [October 22, 2013, 6:45pm UTC](https://discourse.chef.io/t/test-kitchen-and-multiple-converges/4594 "2013-10-22T18:45:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregory\_Symons](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/gregory_symons/32/189_2.png) [@Gregory\_Symons](https://discourse.chef.io/u/Gregory_Symons)\
**Post date:** [October 22, 2013, 6:45pm UTC](https://discourse.chef.io/t/test-kitchen-and-multiple-converges/4594/1 "2013-10-22T18:45:53Z")

</div>

Ohai, Chefs!

I’m trying to set up a test in test-kitchen to verify the idempotency of  
one of my resource providers. Has anybody else come up with a way to 1)  
converge multiple times in a test-kitchen suite and 2) after a second  
converge verify that nothing has changed (or at the very least none of  
the things that potentially could’ve changed if the recipe wasn’t  
idempotent)? I tried testing this in chefspec, but unfortunately it  
looks like I need a real chef run to expose my idempotency bug.

Thanks,

Greg

---

<div class="post-metadata">

**Author:** ![Ranjib](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/ranjib/32/1040_2.png) [@Ranjib](https://discourse.chef.io/u/Ranjib)\
**Post date:** [October 22, 2013, 8:17pm UTC](https://discourse.chef.io/t/test-kitchen-and-multiple-converges/4594/2 "2013-10-22T20:17:27Z")

</div>

yes, you can not do that with chefspec. I test the same, but with lxc &  
chef zero. I also use a handler to store the updated resources/all resource  
count. I think you can dont know whats the state of tk, last time i checked  
it didnt had support for chefserver. If it has now (probably chef-zero  
support is also there), you can use a handler to store those values, and  
assert after second convergence.

On Tue, Oct 22, 2013 at 11:45 AM, Greg Symons [gsymons@drillinginfo.com](mailto:gsymons@drillinginfo.com)wrote:

> Ohai, Chefs!
> 
> I'm trying to set up a test in test-kitchen to verify the idempotency of  
> one of my resource providers. Has anybody else come up with a way to 1)  
> converge multiple times in a test-kitchen suite and 2) after a second  
> converge verify that nothing has changed (or at the very least none of the  
> things that potentially could've changed if the recipe wasn't idempotent)?  
> I tried testing this in chefspec, but unfortunately it looks like I need a  
> real chef run to expose my idempotency bug.
> 
> Thanks,
> 
> Greg

---

<div class="post-metadata">

**Author:** ![Ranjib](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/ranjib/32/1040_2.png) [@Ranjib](https://discourse.chef.io/u/Ranjib)\
**Post date:** [October 22, 2013, 8:18pm UTC](https://discourse.chef.io/t/test-kitchen-and-multiple-converges/4594/3 "2013-10-22T20:18:45Z")

</div>

sorry for the typo: "I think you can do the same with tk now, with some  
effort. I dont know..."

🙂 ranjib

On Tue, Oct 22, 2013 at 1:17 PM, Ranjib Dey [dey.ranjib@gmail.com](mailto:dey.ranjib@gmail.com) wrote:

> yes, you can not do that with chefspec. I test the same, but with lxc &  
> chef zero. I also use a handler to store the updated resources/all resource  
> count. I think you can dont know whats the state of tk, last time i checked  
> it didnt had support for chefserver. If it has now (probably chef-zero  
> support is also there), you can use a handler to store those values, and  
> assert after second convergence.
> 
> On Tue, Oct 22, 2013 at 11:45 AM, Greg Symons [gsymons@drillinginfo.com](mailto:gsymons@drillinginfo.com)wrote:
> 
> > Ohai, Chefs!
> > 
> > I'm trying to set up a test in test-kitchen to verify the idempotency of  
> > one of my resource providers. Has anybody else come up with a way to 1)  
> > converge multiple times in a test-kitchen suite and 2) after a second  
> > converge verify that nothing has changed (or at the very least none of the  
> > things that potentially could've changed if the recipe wasn't idempotent)?  
> > I tried testing this in chefspec, but unfortunately it looks like I need a  
> > real chef run to expose my idempotency bug.
> > 
> > Thanks,
> > 
> > Greg

---

<div class="post-metadata">

**Author:** ![millisami\_r](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/millisami_r/32/418_2.png) [@millisami\_r](https://discourse.chef.io/u/millisami_r)\
**Post date:** [October 23, 2013, 7:16am UTC](https://discourse.chef.io/t/test-kitchen-and-multiple-converges/4594/4 "2013-10-23T07:16:42Z")

</div>

@Ranjib, do you have any post/article on how you do with chefspec and  
chef-zero?

@millisami  
~Sachin Sagar Rai  
Ruby on Rails Developer  
[http://tfm.com.np](http://tfm.com.np)  
[http://nepalonrails.com](http://nepalonrails.com)

On Wed, Oct 23, 2013 at 2:03 AM, Ranjib Dey [dey.ranjib@gmail.com](mailto:dey.ranjib@gmail.com) wrote:

> sorry for the typo: "I think you can do the same with tk now, with some  
> effort. I dont know..."
> 
> 🙂 ranjib
> 
> On Tue, Oct 22, 2013 at 1:17 PM, Ranjib Dey [dey.ranjib@gmail.com](mailto:dey.ranjib@gmail.com) wrote:
> 
> > yes, you can not do that with chefspec. I test the same, but with lxc &  
> > chef zero. I also use a handler to store the updated resources/all resource  
> > count. I think you can dont know whats the state of tk, last time i checked  
> > it didnt had support for chefserver. If it has now (probably chef-zero  
> > support is also there), you can use a handler to store those values, and  
> > assert after second convergence.
> > 
> > On Tue, Oct 22, 2013 at 11:45 AM, Greg Symons [gsymons@drillinginfo.com](mailto:gsymons@drillinginfo.com)wrote:
> > 
> > > Ohai, Chefs!
> > > 
> > > I'm trying to set up a test in test-kitchen to verify the idempotency of  
> > > one of my resource providers. Has anybody else come up with a way to 1)  
> > > converge multiple times in a test-kitchen suite and 2) after a second  
> > > converge verify that nothing has changed (or at the very least none of the  
> > > things that potentially could've changed if the recipe wasn't idempotent)?  
> > > I tried testing this in chefspec, but unfortunately it looks like I need a  
> > > real chef run to expose my idempotency bug.
> > > 
> > > Thanks,
> > > 
> > > Greg

---

<div class="post-metadata">

**Author:** ![Seth\_Vargo1](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Seth\_Vargo1](https://discourse.chef.io/u/Seth_Vargo1)\
**Post date:** [October 23, 2013, 2:57pm UTC](https://discourse.chef.io/t/test-kitchen-and-multiple-converges/4594/5 "2013-10-23T14:57:10Z")

</div>

Sachin,

There’s some documentation at the end of the ChefSpec readme: [https://github.com/sethvargo/chefspec#using-chef-zero](https://github.com/sethvargo/chefspec#using-chef-zero). And there’s also a ticket for ChefSpec 3.1.0 to make this integration better. In short, you need to start up a server (which is detailed in the link above), and then setup your Chef config to point to it.

Thanks,  
Seth Vargo  
Solutions Engineer, Opscode  
@sethvargo  
From: millisami r millisami r  
Reply: [chef@lists.opscode.com](mailto:chef@lists.opscode.com) [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Date: October 23, 2013 at 3:17:11 AM  
To: chef [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Re: test-kitchen and multiple converges  
@Ranjib, do you have any post/article on how you do with chefspec and chef-zero?

@millisami  
~Sachin Sagar Rai  
Ruby on Rails Developer  
[http://tfm.com.np](http://tfm.com.np)  
[http://nepalonrails.com](http://nepalonrails.com)

On Wed, Oct 23, 2013 at 2:03 AM, Ranjib Dey [dey.ranjib@gmail.com](mailto:dey.ranjib@gmail.com) wrote:  
sorry for the typo: “I think you can do the same with tk now, with some effort. I dont know…”

🙂 ranjib

On Tue, Oct 22, 2013 at 1:17 PM, Ranjib Dey [dey.ranjib@gmail.com](mailto:dey.ranjib@gmail.com) wrote:  
yes, you can not do that with chefspec. I test the same, but with lxc & chef zero. I also use a handler to store the updated resources/all resource count. I think you can dont know whats the state of tk, last time i checked it didnt had support for chefserver. If it has now (probably chef-zero support is also there), you can use a handler to store those values, and assert after second convergence.

On Tue, Oct 22, 2013 at 11:45 AM, Greg Symons [gsymons@drillinginfo.com](mailto:gsymons@drillinginfo.com) wrote:  
Ohai, Chefs!

I’m trying to set up a test in test-kitchen to verify the idempotency of one of my resource providers. Has anybody else come up with a way to 1) converge multiple times in a test-kitchen suite and 2) after a second converge verify that nothing has changed (or at the very least none of the things that potentially could’ve changed if the recipe wasn’t idempotent)? I tried testing this in chefspec, but unfortunately it looks like I need a real chef run to expose my idempotency bug.

Thanks,

Greg
