fat rabbit
fat rabbit

Reputation: 25

Is ChefSpec in chef really usable compared to testing with Kitchen

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:

How to use ChefSpec with Chef to see the same benefits like TDD/BDD in Java for example.

Upvotes: 1

Views: 1113

Answers (2)

coderanger
coderanger

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

gsone
gsone

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

Related Questions