Chef recipe code coverage

1 · Seth Vargo · Dec. 29, 2013, midnight
How do you do code coverage with Chef? This seems like a simple question and should have a really simple answer. Chef recipes and resources are just Ruby code afterall, so a tool like Simplecov should do the trick... Wrong! During a chef-client run, Chef dynamically loads (and reloads) resources at runtime. Tools like Simplecov rely on parsing Ruby's AST tree to determine when a particular line of code is executed. But, if that file is reloaded, the AST tree is entirely rebuilt in the Ruby V...