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
The
expect_recipematcher currently converges the recipe. The matchers inside the AWS integration tests run converge themselves. We need to expose a new matcher that basically callsexpect( recipe {...})without converging the recipe.The
be_idempotentmatcher 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. Insidebe_idempotentit 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 checkingconverge_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 usingexpect_recipeinstead ofexpect(recipe {?\cc @jkeiser @metadave