Upload
sean-omeara
View
730
Download
2
Tags:
Embed Size (px)
DESCRIPTION
Testing cookbooks on Digital Ocean with Test Kitchen, Serverspec, and ChefSpec
Citation preview
Cookbook Testing with TravisCI, Test Kitchen and Digital Ocean
Sean [email protected]!
@someara
whoami
Writing Cookbooks
Are we done?
Testing Cookbooks
Slightly more involved.
The Basics
http://www.flickr.com/photos/jronaldlee/5295169486/
Run the recipe See what happens
Manual techniques Automated techniques
CLI IS BETTER
Converge Testing
Integration Testing
https://www.flickr.com/photos/kitsa_sakurako/439652830
Test that a set of resources has achieved their combined goal
{testable intent
Test Kitchen runs integration tests out of band of Chef
It does this with bussers
Bats!Serverspec!Minitest!Cucumber
suite busser
kitchen test!!
kitchen converge!run integration tests!kitchen destroy
test
tear down
Style Testing
Ruby level style enforcement
single quotes
space after comma
no trailing whitespace
Chef level style enforcement
http://www.flickr.com/photos/40389360@N00/2428706650/
Regression Testing
ChefSpec makes assertions about compiled resource collections
REFERENCE SLIDE
https://github.com/opscode-cookbooks/yum
https://github.com/opscode-cookbooks/mysql
Reference Cookbooks
https://github.com/opscode-cookbooks/jenkins
https://github.com/opscode-cookbooks/yum-epel
Cookbook Dependencies
Often, a cookbook will depend on another
include_recipe ‘another_cookbook::recipe’!!
OR!!
consume a resource shipped in another_cookbook
For example
not in core Chef
ships in mysql cookbook
Dependencies suck and you don’t want to manage them manually.
Berkshelf is bundler for Chef cookbooks
your chef-server here
Bundler installs dependencies into your local gem cache
Berkshelf installs dependencies into your local cookbook cache
needs moar ServerSpec
Travis CI
Because I like to close my laptop sometimes
I ran out of slides.