Information Technology Reference
In-Depth Information
has the apache web server installed
Finished in 0.03922 seconds
3 examples, 0 failures
Finished verifying <default-centos65> (0m1.14s).
-----> Destroying <default-centos65>...
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
Vagrant instance <default-centos65> destroyed.
Finished destroying <default-centos65> (0m2.89s).
Finished testing <default-centos65> (2m19.03s).
-----> Kitchen is finished. (2m19.48s)
For more on Serverspec, the Jenkins community cookbook is chock-full of advanced Server-
spec techniques. It is a great starting point to learn more about how to perform end-to-end
testing of cookbooks.
Test Automation with Foodcritic
Severspec is an invaluable tool for performing end-to-end testing of cookbook functionality.
However, spinning up a sandbox instance and performing a full Chef converge can take a
long time.
Use the power of Test Kitchen and Serverspec judiciously. Other tools can provide more lim-
ited forms of feedback faster. One example of a tool that can provide limited feedback
quickly is Foodcritic.
Foodcritic is designed to be used as you are writing Chef code, and it can even be integrated
into your editor. Foodcritic provides feedback on your Chef coding style. It does this by per-
forming checks against your code called rules .
You can find all the default rules used by Foodcritic in its documentation , as shown in Fig-
ure 16-14 . You'll need to scroll down a bit on the web page to see them.
You run foodcritic on your development host instead of in a sandbox environment, so it is
fast. Give it a try now. Make sure the root apache-test root cookbook is your current work-
ing directory, and run the following. The results you see might differ depending on whether
you are using the Chef Development Kit or Chef Client.
Chef Development Kit:
Search WWH ::




Custom Search