Wednesday, September 28, 2022

[FIXED] How do you report errors to chef from a test suite?

Issue

If I run a test suite upon install how would I report errors to chef? More generally, are there great packages for verifying system state?

Does this simply involve returning error codes on exit or are there more verbose ways of interacting with Chef?


Solution

I highly recommend two tools:

These are great tools for testing the various logic branches and behaviors of your cookbook. ChefSpec will perform an in-memory Chef run, so it's perfect for unit testing and fast feedback loops. Test Kitchen will converge a real node (using Vagrant by default) and then use a busser (such as Bats or Serverspec) to validate the state of the system at the end of converge.

In production, Chef also has native report handling and error reporting. According to the documentation, you can create your own handlers for notifications.



Answered By - sethvargo
Answer Checked By - David Goodson (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.