Reputation: 25
I had covered recipe code with ChefSpec and after that I have integration testing with Kitchen. To me at the end ChefSpec is not really usable just one extra think to maintain because:
When I'm writing Java with TDD/BDD I see real benefits from using this approach- lots of smaller classes, DI integration, modularity, less bugs.
However with Chef and ChefSpec to me is only usable default generated spec the helps me with some compile and syntax errors.
How to use ChefSpec with Chef to see the same benefits like TDD/BDD in Java for example.
Upvotes: 1
Views: 1113
Reputation: 54211
ChefSpec is an RSpec library, which I think is what you're referring to. It is built for unit testing, which it accomplishes by having all providers default to not actually running. So it does a "converge" but without any actual implementation of anything so it goes very quickly. The downside being that you can't actually check if the side effects were what you thought they should be. For that you need to actually run Chef for real, and that is what Test Kitchen is for. It is a framework for creating a VM, running Chef on it, and then running some kind of correctness tests on the VM. For the correctness tests you can use many tools, but the most common are Serverspec (which is an RSpec library) and InSpec (which isn't an RSpec library but kind of looks like one for the most part).
So RSpec is involved with both unit and integration testing, but for different tasks.
Upvotes: 1
Reputation: 1231
ChefSpec is a faster way to run recipes because its using Chef Solo. In that way you are able to provide different node attributes, assert behaviors that's are OS specific without running Kitchen.
Upvotes: 1