Traditionally, most of infrastructure is managed manually or by using scripts. This inconsistency causes many issues in infrastructure. TDD is known for increasing code quality, improving overall design, and allowing safe refactoring throughout a project. Explaining about how, why and which tools we should use to test code. So, I am going to explain about the how and why we should test our code and what are tools are available to test our infrastructure code.
Before Getting into actual usage of tool we should understand the phases of
- Pre-convergence: Testing phase that does not require any node to run the test.
- Convergence: Chef runs and make changes to the system on node.
- Post-convergence: Node finishes running Chef, also verifying that node is in the desired state.