Saturday, March 28, 2015

Agile India Conference 2015: Test Driven Development of Infrastructure code in Chef

This presentation talks about test driven development of infrastructure as code.
TDD is all about writing test first and then writing the code.
Infrastructure code is code to build the infrastructure. It facilitates devops culture and help continuous delivery.

Shell scripts are not very maintainable. Chef kind of language is a domain specific language which is better maintainable. It uses the underlying package manager of the OS, wherever required.
We need to test whether the installation etc has happened rightly or not. We need to create an enviroment first and also should have a mechanism to test.
Chef works in client server mode.
Chef requires the server and uses workstation to edit the code to be hosted in the server. The client uses the http protocol to connect ot the server. Workstations also bootstraps the chef client in nodes. 
Recipy is like a file that does the basic task like installing a sql.
cookbook is like collection of recipies. It can be a collection of recipies that can be uploaded. Cookbook applies at an component level. Example- For tomcat there will be a cookbook and there can be task that can be put together as recipies in the cookbook.
Runlist is a list of recipe. 

Chef can be used for creating installers of different software for automating the developer workstation environment also.

Test Framework

Writing test:
running from command the test. test fail as there is no code:
write some code in the yml:

Unit test framework- to give quickest feedback
deploying it to the server
Chef Supermarket has list of cookbooks which can be reused.
Chef control panel

No comments: