Test-kitchen and multiple converges

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

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.comwrote:

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

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

:slight_smile: ranjib

On Tue, Oct 22, 2013 at 1:17 PM, Ranjib Dey 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.comwrote:

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

@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://nepalonrails.com

On Wed, Oct 23, 2013 at 2:03 AM, Ranjib Dey 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..."

:slight_smile: ranjib

On Tue, Oct 22, 2013 at 1:17 PM, Ranjib Dey 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.comwrote:

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

Sachin,

There’s some documentation at the end of the ChefSpec readme: 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 chef@lists.opscode.com
Date: October 23, 2013 at 3:17:11 AM
To: chef 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://nepalonrails.com

On Wed, Oct 23, 2013 at 2:03 AM, Ranjib Dey 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…”

:slight_smile: ranjib

On Tue, Oct 22, 2013 at 1:17 PM, Ranjib Dey 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 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