SlideShare a Scribd company logo
Chef Tooling & TDD
Sai/ Ops Tools
Existing Chef Workflow
1. Engineer writes a chef cookbook
2. May perhaps write Minitest suite
3. May spin up vagrant with chef solo
4. Engineer does a `Rake release`
a. Json lint
b. FoodCritic warnings
c. Push to hooks
d. Berks upload cookbook
Chef Tooling
● Pre-convergence - Linting, Style and Rules
● Unit-tests
● Convergence - Integration Tests
● Post Convergence
Cookstyle/Rubocop
● Cookstyle - Invoked with Rubocop. Does autocorrection with rules from
cookstyle.yml
● Rubocop - Static Code analyzes code for Ruby errors and style guidelines
> rubocop recipes/counter.rb
Foodcritic
● Flags problems that may cause chef cookbooks to fail
● Chef cookbook style guidelines
>foodcritic -B bjn_counter
Foodcritic
Unit Tests
ChefSpec
● Rspec style unit testing for cookbooks
● Help regression testing when making changes
● Simulate convergence of resources on node
But do we really need this, if we use tools in convergence?
● Does not test chef runs
● May not catch all failures in spite of perfect run
Integration Testing
# Test Kitchen
What is it?
● Test Harness
● Allows to execute code on one or more platforms in isolation
● Cloud Providers, dockers, vagrant and VMs
● Supports testing frameworks - Inspec, minitest, Serverspec and BATS
● Uses kitchen-vagrant driver for managing vms (just like vagrant-berkshelf)
Why use Test Kitchen?
● Multiple platforms support with single config
● Chef-zero does not require additional flags for environment, roles, data bags
etc. Not required to add chef-solo conditionals in recipes.
● Full in-memory, fast start so chef runs for zero would be faster.
● Minitest is no longer actively supported and is being deprecated in favour of
inspec :(
Test kitchen commands
● vagrant status ⇔ kitchen list
● vagrant up ⇔ kitchen converge
● vagrant provision
● vagrant ssh ⇔ kitchen login
● minitest-handler ⇔ kitchen verify (supports inspec, serverspec)
● kitchen test (all in one)
Post-Convergence
Inspec
● Rspec like tests to ensure state of node
● Built in resource types for Chef
● Add tests for business assumptions and outcomes
New Chef Tooling
● Cookstyle/Rubocop
● FoodCritic
● ChefSpec
● Test Kitchen
● Inspec
● Automate into CI
1. Replace hooks with Jenkins jobs that download cookbooks, upload to
Chef server
Other Tools
● Cookbook skeleton generator - Bourdain/Chef/Kitchen-cabinet
● Bump and release cookbooks - Bourdain
● Berkshelf over Policyfiles
● Chef Push jobs - Ansible/Rundeck style jobs triggered independently of chef
runs
Sources
● https://docs.chef.io
● Alex Manly - Chef workflow
https://www.youtube.com/watch?v=jauXuwIfgbs&t=49s
● Inspec - https://www.inspec.io/tutorials/
● Chef solo to Zero - https://blog.chef.io/2014/06/24/from-solo-to-zero-
migrating-to-chef-client-local-mode/
● kitchen.ci

More Related Content

What's hot

Git
GitGit
Effective version control
Effective version controlEffective version control
Effective version control
ColdFusionConference
 
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
Samsul Ma'arif
 
Jenkins pipeline as code
Jenkins pipeline as codeJenkins pipeline as code
Jenkins pipeline as code
Mohammad Imran Ansari
 
Git workflows
Git workflowsGit workflows
Git workflows
Sergiu Savva
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
Sergiu-Ioan Ungur
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
Mikhail Melnik
 
8th alg -feb18
8th alg -feb188th alg -feb18
8th alg -feb18
jdurst65
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
Mack Hardy
 
Rubyconf presentation
Rubyconf presentationRubyconf presentation
Rubyconf presentation
krevuri
 
Building a raku module
Building a raku moduleBuilding a raku module
Building a raku module
Simon Proctor
 
Jump into React-Native (Class 6)
Jump into React-Native  (Class 6)Jump into React-Native  (Class 6)
Jump into React-Native (Class 6)
Waqqas Jabbar
 
SOFTWARE ENGINEERING - PM Review
SOFTWARE ENGINEERING - PM ReviewSOFTWARE ENGINEERING - PM Review
SOFTWARE ENGINEERING - PM Review
Jeremy Zhong
 
Deploying a Chef Server
Deploying a Chef ServerDeploying a Chef Server
Deploying a Chef Server
Hart Hoover
 
San Antonio Chef Users Meetup, Jun 2014 - Chef Metal
San Antonio Chef Users Meetup, Jun 2014 - Chef MetalSan Antonio Chef Users Meetup, Jun 2014 - Chef Metal
San Antonio Chef Users Meetup, Jun 2014 - Chef Metal
Hart Hoover
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and Tags
Mikhail Melnik
 

What's hot (16)

Git
GitGit
Git
 
Effective version control
Effective version controlEffective version control
Effective version control
 
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
Deploy Multinode GitLab Runner in openSUSE 15.1 Instances with Ansible Automa...
 
Jenkins pipeline as code
Jenkins pipeline as codeJenkins pipeline as code
Jenkins pipeline as code
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
8th alg -feb18
8th alg -feb188th alg -feb18
8th alg -feb18
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Rubyconf presentation
Rubyconf presentationRubyconf presentation
Rubyconf presentation
 
Building a raku module
Building a raku moduleBuilding a raku module
Building a raku module
 
Jump into React-Native (Class 6)
Jump into React-Native  (Class 6)Jump into React-Native  (Class 6)
Jump into React-Native (Class 6)
 
SOFTWARE ENGINEERING - PM Review
SOFTWARE ENGINEERING - PM ReviewSOFTWARE ENGINEERING - PM Review
SOFTWARE ENGINEERING - PM Review
 
Deploying a Chef Server
Deploying a Chef ServerDeploying a Chef Server
Deploying a Chef Server
 
San Antonio Chef Users Meetup, Jun 2014 - Chef Metal
San Antonio Chef Users Meetup, Jun 2014 - Chef MetalSan Antonio Chef Users Meetup, Jun 2014 - Chef Metal
San Antonio Chef Users Meetup, Jun 2014 - Chef Metal
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and Tags
 

Similar to Chef tooling and TDD

CI for Chefs
CI for ChefsCI for Chefs
CI for Chefs
Nikolay Yurin
 
An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...
ulfmansson
 
MadridDevops September 2014: "From chef09 to chef11, one approach to devops"
MadridDevops September 2014: "From chef09 to chef11, one approach to devops"MadridDevops September 2014: "From chef09 to chef11, one approach to devops"
MadridDevops September 2014: "From chef09 to chef11, one approach to devops"
Antonio Peña
 
DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...
DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...
DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...
DevOps_Fest
 
Emerging chef patterns and practices
Emerging chef patterns and practicesEmerging chef patterns and practices
Emerging chef patterns and practices
Owain Perry
 
Chef Cookbook Workflow
Chef Cookbook WorkflowChef Cookbook Workflow
Chef Cookbook Workflow
Amazon Web Services
 
Ansible, integration testing, and you.
Ansible, integration testing, and you.Ansible, integration testing, and you.
Ansible, integration testing, and you.
Bob Killen
 
What is Test Kitchen
What is Test KitchenWhat is Test Kitchen
What is Test Kitchen
Benoit Caron
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and Docker
Mandi Walls
 
Habitat Managed Chef
Habitat Managed ChefHabitat Managed Chef
Habitat Managed Chef
Chef
 
Terraform Testing with InSpec Demo
Terraform Testing with InSpec DemoTerraform Testing with InSpec Demo
Terraform Testing with InSpec Demo
Annie Hedgpeth
 
QA to sous-Chef
QA to sous-ChefQA to sous-Chef
Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5
Chef
 
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Patrick McDonnell
 
Chef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetupChef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetup
Promet Source
 
Chef - Administration for programmers
Chef - Administration for programmersChef - Administration for programmers
Chef - Administration for programmers
mrsabo
 
Managing Servers with Chef
Managing Servers with ChefManaging Servers with Chef
Managing Servers with Chef
Joe Kepley
 
Chef
ChefChef
Cfg mgmtcamp c-dwithchef
Cfg mgmtcamp c-dwithchefCfg mgmtcamp c-dwithchef
Cfg mgmtcamp c-dwithchef
George Miranda
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and Friends
Ben McRae
 

Similar to Chef tooling and TDD (20)

CI for Chefs
CI for ChefsCI for Chefs
CI for Chefs
 
An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...
 
MadridDevops September 2014: "From chef09 to chef11, one approach to devops"
MadridDevops September 2014: "From chef09 to chef11, one approach to devops"MadridDevops September 2014: "From chef09 to chef11, one approach to devops"
MadridDevops September 2014: "From chef09 to chef11, one approach to devops"
 
DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...
DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...
DevOps Fest 2019. Олег Белецкий. Using Chef to manage hardware-based infrastr...
 
Emerging chef patterns and practices
Emerging chef patterns and practicesEmerging chef patterns and practices
Emerging chef patterns and practices
 
Chef Cookbook Workflow
Chef Cookbook WorkflowChef Cookbook Workflow
Chef Cookbook Workflow
 
Ansible, integration testing, and you.
Ansible, integration testing, and you.Ansible, integration testing, and you.
Ansible, integration testing, and you.
 
What is Test Kitchen
What is Test KitchenWhat is Test Kitchen
What is Test Kitchen
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and Docker
 
Habitat Managed Chef
Habitat Managed ChefHabitat Managed Chef
Habitat Managed Chef
 
Terraform Testing with InSpec Demo
Terraform Testing with InSpec DemoTerraform Testing with InSpec Demo
Terraform Testing with InSpec Demo
 
QA to sous-Chef
QA to sous-ChefQA to sous-Chef
QA to sous-Chef
 
Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5Environments - Fundamentals Webinar Series Week 5
Environments - Fundamentals Webinar Series Week 5
 
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
 
Chef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetupChef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetup
 
Chef - Administration for programmers
Chef - Administration for programmersChef - Administration for programmers
Chef - Administration for programmers
 
Managing Servers with Chef
Managing Servers with ChefManaging Servers with Chef
Managing Servers with Chef
 
Chef
ChefChef
Chef
 
Cfg mgmtcamp c-dwithchef
Cfg mgmtcamp c-dwithchefCfg mgmtcamp c-dwithchef
Cfg mgmtcamp c-dwithchef
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and Friends
 

Recently uploaded

22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
MiscAnnoy1
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
shahdabdulbaset
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 

Recently uploaded (20)

22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 

Chef tooling and TDD

  • 1. Chef Tooling & TDD Sai/ Ops Tools
  • 2. Existing Chef Workflow 1. Engineer writes a chef cookbook 2. May perhaps write Minitest suite 3. May spin up vagrant with chef solo 4. Engineer does a `Rake release` a. Json lint b. FoodCritic warnings c. Push to hooks d. Berks upload cookbook
  • 3. Chef Tooling ● Pre-convergence - Linting, Style and Rules ● Unit-tests ● Convergence - Integration Tests ● Post Convergence
  • 4. Cookstyle/Rubocop ● Cookstyle - Invoked with Rubocop. Does autocorrection with rules from cookstyle.yml ● Rubocop - Static Code analyzes code for Ruby errors and style guidelines > rubocop recipes/counter.rb
  • 5.
  • 6. Foodcritic ● Flags problems that may cause chef cookbooks to fail ● Chef cookbook style guidelines
  • 8. Unit Tests ChefSpec ● Rspec style unit testing for cookbooks ● Help regression testing when making changes ● Simulate convergence of resources on node But do we really need this, if we use tools in convergence? ● Does not test chef runs ● May not catch all failures in spite of perfect run
  • 9. Integration Testing # Test Kitchen What is it? ● Test Harness ● Allows to execute code on one or more platforms in isolation ● Cloud Providers, dockers, vagrant and VMs ● Supports testing frameworks - Inspec, minitest, Serverspec and BATS ● Uses kitchen-vagrant driver for managing vms (just like vagrant-berkshelf)
  • 10. Why use Test Kitchen? ● Multiple platforms support with single config ● Chef-zero does not require additional flags for environment, roles, data bags etc. Not required to add chef-solo conditionals in recipes. ● Full in-memory, fast start so chef runs for zero would be faster. ● Minitest is no longer actively supported and is being deprecated in favour of inspec :(
  • 11. Test kitchen commands ● vagrant status ⇔ kitchen list ● vagrant up ⇔ kitchen converge ● vagrant provision ● vagrant ssh ⇔ kitchen login ● minitest-handler ⇔ kitchen verify (supports inspec, serverspec) ● kitchen test (all in one)
  • 12. Post-Convergence Inspec ● Rspec like tests to ensure state of node ● Built in resource types for Chef ● Add tests for business assumptions and outcomes
  • 13. New Chef Tooling ● Cookstyle/Rubocop ● FoodCritic ● ChefSpec ● Test Kitchen ● Inspec ● Automate into CI 1. Replace hooks with Jenkins jobs that download cookbooks, upload to Chef server
  • 14. Other Tools ● Cookbook skeleton generator - Bourdain/Chef/Kitchen-cabinet ● Bump and release cookbooks - Bourdain ● Berkshelf over Policyfiles ● Chef Push jobs - Ansible/Rundeck style jobs triggered independently of chef runs
  • 15. Sources ● https://docs.chef.io ● Alex Manly - Chef workflow https://www.youtube.com/watch?v=jauXuwIfgbs&t=49s ● Inspec - https://www.inspec.io/tutorials/ ● Chef solo to Zero - https://blog.chef.io/2014/06/24/from-solo-to-zero- migrating-to-chef-client-local-mode/ ● kitchen.ci