Chef/inspec with testing auto-runner

Hi there,

I just wonder is there some tools like Guard gem compatible with chef/inspec (
Guard is configured with a Guardfile that tells it which directories and files to monitor, and what command to run when they change.

So I’d love to run a test suite when spec files are changed.
Do you know any tools like this?

InSpec is going to work with “real” machines, but I see this plugin for
Guard and Test Kitchen (2013!)

“kitchen verify” with your verifier set to inspec would work, no experience
with Guard myself though.

Matt Ray
Manager, Solutions Architect - APJ :: Chef
AUS: +61 457 231 372
US: +1 512 731 2218
mattray :: GitHub :: IRC :: Slack :: Twitter

The Guard project definitely will definitely work. Consider using guard-shell. It’s generic and when file events are generated you can run a command on that particular file or the entire profile.

$ guard init shell


command = "inspec exec"
target = "-t TARGET_INSTANCE"

guard :shell do
  watch /controls\/.+\.rb/ do |m|
    m[0] + " has changed."
    `#{command} #{m[0]} #{target}`

  watch /inspec\.yml/ do
     `#{command} . #{target}`

The first guard will check to see if a Ruby file within the controls directory changed. If it does execute the command inspec exec control/FILENAME.rb -t TARGET_INSTANCE. The second guard will watch to see if the `inspec.yml’ file changes and run the entire profile.

This could be refined a bit but I think this hopefully conveys an approach.