BDD / TDD for libraries+fat resources / LWR/P


#1

Yo,

I recently had the chance to write an advanced resource inside of a Library
in a cookbook, much in the way chef-deploy used to be shipped prior to us
merging it in 0.7.x.

It basically wraps RemoteFile, but adds bucket_name, object & credz:
auto-generating 10-minute signed URL’s for Amazon’s S3.

It felt like it needed tests, but there was no (obvious) mechanism to jam
some spec/ into, so I lumped it together with my (growing) pile of
non-tested Infrastructure automation code.

Feels like I need a “validate” resource that you can chuck at the end of a
recipe that runs off and runs some User Stories or some shit.

Thoughts?

AJ


#2

rake task and a spec dir per cookbook ?

I’ve been trying to noodle a way to test some library code that hooks resources as well. Not really a great spec writer myself i’ve just left the bits that are playing with chef internals for now. Would love to have some best practices laid out in this regard.

P.S.
having knife run specs on cookbook upload would be super :slight_smile:

On Oct 29, 2010, at 11:21 AM, AJ Christensen wrote:

Yo,

I recently had the chance to write an advanced resource inside of a Library in a cookbook, much in the way chef-deploy used to be shipped prior to us merging it in 0.7.x.

It basically wraps RemoteFile, but adds bucket_name, object & credz: auto-generating 10-minute signed URL’s for Amazon’s S3.

It felt like it needed tests, but there was no (obvious) mechanism to jam some spec/ into, so I lumped it together with my (growing) pile of non-tested Infrastructure automation code.

Feels like I need a “validate” resource that you can chuck at the end of a recipe that runs off and runs some User Stories or some shit.

Thoughts?

AJ