Continuous Integration

On Fri, Jul 9, 2010 at 12:20 PM, Jeremy Deininger jeremy@rightscale.com wrote:

Hey guys,
Thought I'd chime in with my experience testing system configuration code @
RightScale so far. What we've been building are integration style cucumber
tests to run a cookbook through it's paces on all platforms and OSs that we
support.

First we use our API to spin up 'fresh' server clusters in EC2, one for
every platform/OS (variation) that the cookbook will be supporting. The
same could be done using other cloud APIs (anyone else doing this with
VMware or etc?) Starting from scratch is important because of chef's
idempotent nature.

Then a cucumber test is run against every variation in parallel. The
cucumber test runs a series of recipes on the cluster then uses what we call
'spot checks' to ensure the cluster is configured and functional. The spot
checks are updated when we find a bug, to cover the bug. An example spot
check would be, sshing to every server and checking the mysql.err file for
bad strings.

These high level integration tests are long running but have been very
useful flushing out bugs.
-J

This sounds like exactly the right approach. Is it open source (yet)?

Are you using Cucumber tests, or a home brew cucumber like test?

If you're using a publicly available integration framework, would you mind sharing with the class?

The thought of using an actual, plain text, cucumber feature document to test system configuration is very appealing.

--
Ryan C. Creasey
Principal Systems Engineer
Technology Operations
IGN Entertainment

On Jul 9, 2010, at 12:21 PM, "Jeremy Deininger" jeremy@rightscale.com wrote:

Hey guys,
Thought I'd chime in with my experience testing system configuration code @ RightScale so far. What we've been building are integration style cucumber tests to run a cookbook through it's paces on all platforms and OSs that we support.

First we use our API to spin up 'fresh' server clusters in EC2, one for every platform/OS (variation) that the cookbook will be supporting. The same could be done using other cloud APIs (anyone else doing this with VMware or etc?) Starting from scratch is important because of chef's idempotent nature.

Then a cucumber test is run against every variation in parallel. The cucumber test runs a series of recipes on the cluster then uses what we call 'spot checks' to ensure the cluster is configured and functional. The spot checks are updated when we find a bug, to cover the bug. An example spot check would be, sshing to every server and checking the mysql.err file for bad strings.

These high level integration tests are long running but have been very useful flushing out bugs.
-J

Yea, getting at your step definitions would be sweeeeeet.

On Fri, Jul 9, 2010 at 3:26 PM, Chad Woolley thewoolleyman@gmail.comwrote:

On Fri, Jul 9, 2010 at 12:20 PM, Jeremy Deininger jeremy@rightscale.com
wrote:

Hey guys,
Thought I'd chime in with my experience testing system configuration code
@
RightScale so far. What we've been building are integration style
cucumber
tests to run a cookbook through it's paces on all platforms and OSs that
we
support.

First we use our API to spin up 'fresh' server clusters in EC2, one for
every platform/OS (variation) that the cookbook will be supporting. The
same could be done using other cloud APIs (anyone else doing this with
VMware or etc?) Starting from scratch is important because of chef's
idempotent nature.

Then a cucumber test is run against every variation in parallel. The
cucumber test runs a series of recipes on the cluster then uses what we
call
'spot checks' to ensure the cluster is configured and functional. The
spot
checks are updated when we find a bug, to cover the bug. An example spot
check would be, sshing to every server and checking the mysql.err file
for
bad strings.

These high level integration tests are long running but have been very
useful flushing out bugs.
-J

This sounds like exactly the right approach. Is it open source (yet)?

Yes it will be OSS. Right now we're actively refactoring an extremely rough
prototype of the project I described. It's RightScale specific (aka
cookbooks with RightScale and ServerTemplate oriented). If you stop by the
#rightscale channel on Freenode I'd be happy to embarrass myself by giving
you a sneak peak at the features etc.. Would love to bounce ideas around
and collaborate if you're interested.

-jeremydei on Freenode IRC

This sounds like exactly the right approach. Is it open source (yet)?

Single cbook testing doesn't interest me as much as the complex interactions of various cookbooks. If you have many people writing cookbooks realistically testing every permutation and output doesn't seem logistically feasible. Pulling a subset of the runlist from prod chef and running it over that would be good. perhaps cookbook meta data could help with knowing what a cookbook should be able to run with or can't run with.

I agree with andrew that we are already declaring a lot of the state, but simply asserting against that state seems a little redundant. Especially when we are dynamically configuring something. I suppose the assumption is that if chef says a package installed then it is installed. At some point we have to trust that the tool is doing what it says, is erroring if its not/can't, and is doing so in a graceful non destructive manner (thats the job of the framework).

Some simple code that could take chef recipes and magic up some cucumber or similar testing framework would be infinitely useful for most people i suspect. If it could generate basic test for cookbooks that plug into cucumber-nagios or something similar. you have some sweet sauce there.

Generic service for testing functional output of a run was also something we were talking about. being able to have confidence in the output being correct for an application at the very minimum being syntactically correct is at least a step. I.e. i want to take output form the apache cookbook which has dynamic inputs and know that on the other end what the human has put in is going to be parsed by httpd without syntax errors. I believe there is value there.

my apologies if this comes off a little scatter brained im just into my first cup of coffee this morning.

On Jul 9, 2010, at 12:20 PM, Jeremy Deininger wrote:

Hey guys,
Thought I'd chime in with my experience testing system configuration code @ RightScale so far. What we've been building are integration style cucumber tests to run a cookbook through it's paces on all platforms and OSs that we support.

First we use our API to spin up 'fresh' server clusters in EC2, one for every platform/OS (variation) that the cookbook will be supporting. The same could be done using other cloud APIs (anyone else doing this with VMware or etc?) Starting from scratch is important because of chef's idempotent nature.

Then a cucumber test is run against every variation in parallel. The cucumber test runs a series of recipes on the cluster then uses what we call 'spot checks' to ensure the cluster is configured and functional. The spot checks are updated when we find a bug, to cover the bug. An example spot check would be, sshing to every server and checking the mysql.err file for bad strings.

These high level integration tests are long running but have been very useful flushing out bugs.
-J

On Sat, Jul 10, 2010 at 1:38 PM, Jesse Nelson spheromak@gmail.com wrote:

Some simple code that could take chef recipes and magic up some cucumber or similar testing framework would be infinitely useful for most people i suspect. If it could generate basic test for cookbooks that plug into cucumber-nagios or something similar. you have some sweet sauce there.

Good idea, and very possible. If a chef recipe declares a service, it
should be possible for the test framework to automatically read that
info from the recipe, and check (via normal OS service status calls)
if it is running on the converged system.

On 10 July 2010 21:55, Chad Woolley thewoolleyman@gmail.com wrote:

On Sat, Jul 10, 2010 at 1:38 PM, Jesse Nelson spheromak@gmail.com wrote:

Some simple code that could take chef recipes and magic up some cucumber or similar testing framework would be infinitely useful for most people i suspect. If it could generate basic test for cookbooks that plug into cucumber-nagios or something similar. you have some sweet sauce there.

At work we're doing something similar to this, although writing the
checks is bit too manual for my liking right now. We essentially use
the Nagios instance within our staging environment as a test suite.
Working on the basis that anything business critical needs to be
monitored, if after a Chef run all services remain green, it's good to
go to production.

There are some aspects that are harder to test like that (scheduled
backup scripts and the like spring to mind), but it's working out ok
during the short time we've been doing it.

Jon