Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic: Examine Testing Community Cookbooks and Wrapper Cookbooks #2

Open
burtlo opened this issue Feb 27, 2016 · 1 comment
Open

Topic: Examine Testing Community Cookbooks and Wrapper Cookbooks #2

burtlo opened this issue Feb 27, 2016 · 1 comment
Labels

Comments

@burtlo
Copy link

burtlo commented Feb 27, 2016

Scott (@drenalin23) wrote:

Future interesting topics would be how to think about testing between community cookbooks and wrapper cookbooks - should I be writing tests for wrappers? Duplicating tests? Etc.

@burtlo burtlo added the topic label Feb 27, 2016
@burtlo
Copy link
Author

burtlo commented Feb 27, 2016

Jaime wrote:

I wrapped it [Community Cookbook] and then added a few of my own recipes but then I started thinking how would I test the cookbook. Would I test just my stuff or would I include the community stuff as well?

Whether you should test your stuff or there stuff is a good thing to think about. Some community cookbooks come with a good test suite. Some do not. It is also definitely hard to wrap a cookbook and then write tests for everything they have done.

I guess I would try and start again with the integration test or tests that really express what you want the state of the system to look like and I think that would work if you wrote your own cookbook or the wrapped cookbook. So I guess, start by ignoring whose cookbook and add the tests that help ensure the desired state.

What becomes difficult after that is how far do you unit test. I would love to talk more specifics and maybe and work with you to get a better idea of the challenges that you may be facing. In the past when I have wrapped cookbooks I have usually done so to workaround a single issue with it or to override a single attribute. Those situations I might call light wrappings. There you could again make expectations about the end state and feel like you have good enough coverage. You could write out expectations about the Chef Run but I would focus on only making assertions on the things that you wrote. So if you set a particular node attribute then you may ensure that it is set.

Now wrapping a cookbook where you are combining a few different recipes, perhaps overriding a lot of attributes, and maybe even using chef-rewind. That is maybe what I would call heavy wrapping and my experience in that area has been fully developed. If you are doing this I would be very interested in working through the problem with you to help learn what are some good practices that come out of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant