chef / cheffish

Resources and tools for testing and interacting with Chef and Chef Server.
Apache License 2.0
38 stars 28 forks source link

Need support for AWS tests #52

Open tyler-ball opened 9 years ago

tyler-ball commented 9 years ago

The expect_recipe matcher currently converges the recipe. The matchers inside the AWS integration tests run converge themselves. We need to expose a new matcher that basically calls expect( recipe {...}) without converging the recipe.

The be_idempotent matcher should check to see if the recipe that just ran had any failures. If it did, we shouldn't try to run it again - this will just cause the recipe to fail again and in the AWS case it will spin up more AWS resource. Inside be_idempotent it looks like we can check chef_run#converge_failed?

Finally, when running the AWS tests (even without expect_recipe) something is trying to converge a failing recipe an additional time. Adding a breakpoint here and you can see it getting called twice (if the recipe being converged raises an exception). A fix might be as simple as checking converge_failed? and not re-converge, but I would like to understand why the converge is being called a second time on a failure. Is it called a second time on success? Is it called a second time if using expect_recipe instead of expect(recipe {?

\cc @jkeiser @metadave

randomcamel commented 9 years ago

Having be_idempotent run the code instead of expect is super goofy, for the record.

jkeiser commented 9 years ago

That's actually how matchers for blocks work. The matcher is responsible for running it.