InterviewSolution
| 1. |
Differentiate unit tests and integration tests in Chef? |
|
Answer» Unit tests are easy to run simpler tests used to test a single unit or component of the infrastructure. Chef uses ChefSpec, an in-built testing framework to write unit tests for the infrastructure. In the infrastructure POINT of view unit tests are VERIFIED on the resource collection created during the Chef Client run and not by actually configuring the node. For eg: If we want to write a unit test to verify if the “Apache” package is installed, no actual installation of the Apache server is TESTED but just verifies if the package “Apache” is added to the resource collection list. Resource collection will have a list of all actions that will be performed in the actual Chef Client run. Integration tests in Chef's perspective are system tests where tests are performed by provisioning a new system and configuring the system to our requirements. This takes a lot of time as we have to perform the actual configuration of the PROVISIONED system. System tests are also a costly affair compared to unit tests as we need to provision a new system exclusively for testing purposes. |
|