Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
TDI with ChefDK 0.0.1
someara
August 12, 2014
Technology
2
230
TDI with ChefDK 0.0.1
Work in progress. Not done yet!
someara
August 12, 2014
Tweet
Share
More Decks by someara
See All by someara
someara
0
92
someara
0
170
someara
1
170
someara
0
140
someara
2
480
someara
3
460
someara
2
350
someara
2
230
someara
10
6k
Other Decks in Technology
See All in Technology
soracom
1
110
ihcomega56
1
440
clustervr
0
130
viva_tweet_x
1
360
gamella
3
1.4k
yasuyukiyamasaki
1
160
sat
39
28k
lmi
2
810
buildersbox
0
150
kanaugust
PRO
0
100
fuzzy31u
0
780
andysumi
0
160
Featured
See All Featured
danielanewman
200
20k
kneath
295
39k
matthewcrist
73
7.5k
holman
461
280k
dougneiner
55
5.4k
stephaniewalter
260
11k
mongodb
23
3.9k
bkeepers
52
4.2k
ammeep
656
54k
roundedbygravity
84
7.9k
gr2m
83
11k
tanoku
258
24k
Transcript
Testing Cookbooks
Sean OMeara! someara@getchef.com! @someara
whoami
Writing Cookbooks
None
None
None
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
None
None
CLI IS BETTER
ChefDK
Our toolchain is in Ruby
Standard Ruby dev setups are tricky to install
System Ruby! RVM! chruby
cd project ; bundle install
None
None
Put the code in the can.
OMNIBUS ChefDK! ! Stable toolchain in an Omnibus installer
None
None
Ruby! Chef! Test Kitchen! kitchen-vagrant! Berkshelf! Foodcritic! Rubocop! ChefSpec
None
Converge Testing
None
CaaP! vs! IaaP
Cookbook as a Project! vs! Infrastructure as a Project
no chef-repo
battery not included
kitchen-vagrant! kitchen-docker! kitchen-ec2! kitchen-rackspace! kitchen-gce! kitchen-digitalocean! kitchen-openstack! kitchen-bluebox! kitchen-joyent! kitchen-lxc
also available
None
None
None
None
None
None
None
None
None
None
Integration Testing ttps://www.flickr.com/photos/kitsa_sakurako/439652830
Test that a set of resources have achieved their combined
goal
{ testable intent
None
None
Test Kitchen runs integration tests out of band of Chef
It does this with bussers
Bats! Serverspec! Minitest! Cucumber
None
suite busser
None
None
kitchen test! ! kitchen converge! kitchen verify! kitchen destroy
test tear down
Style Testing
None
Ruby level style enforcement
None
None
None
None
None
None
single quotes space after comma no trailing whitespace
None
None
Chef level style enforcement
None
None
None
None
None
http://www.flickr.com/photos/40389360@N00/2428706650/ Regression Testing
ChefSpec makes assertions about compiled resource collections
None
None
None
None
None
REFERENCE SLIDE
None
None
None
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
None
None
not in core Chef
ships in mysql cookbook
None
None
Dependencies suck and you don’t want to manage them manually.
None
Berkshelf is bundler for Chef cookbooks
None
your chef-server here
None
Bundler installs dependencies into your local gem cache
Berkshelf installs dependencies into your local cookbook cache
None
None
None
None
None
None
needs moar ServerSpec
Continuous Integration
This is all driven from the command line
Which makes it super easy to wire into CI systems
CI should watch version control for commits
Polling! vs! Notifications
I ran out of slides!