Information Technology Reference
In-Depth Information
Chapter 16. Testing
In this final chapter of the topic, we will cover how to test your Chef automation code. It is
important to perform testing and verification steps before deploying your Chef code to pro-
duction to ensure it works as intended.
In nearly all the exercises in this topic, we've taken care to add sections highlighting how to
manually verify that your Chef code is working properly. In this chapter, we'll show you
how to automate this process.
Testing Rationale
Using a configuration management tool like Chef gets you 50% of the way there in automat-
ing testing and verification. Because Chef automates infrastructure in a repeatable manner, it
inherently makes apps running in these environments more testable. This is why we intro-
duced Test Kitchen so early in the topic, in Chapter 5 , so that you could see this in action.
Throughout the topic, you've deployed your Chef code to a local development sandbox en-
vironment. Using Test Kitchen should give you confidence that if you deployed the same
code to a production Chef environment, it will behave in the same manner.
The other 50% of the testing rationale, besides using Chef in the first place, is to be strategic
when testing and deploying automation code. Just as it is best to introduce change to applica-
tion code in small batches, it is also best to introduce change to your infrastructure in small
batches. As Figure 16-1 shows, you should work in short bursts, performing a short build-
test-deploy cycle. This approach can help ensure that enough testing gets done to result in an
infrastructure and application of high quality.
Search WWH ::




Custom Search