This relies on the following assumptions:
- The environment(s) must exist (make them in the WebUI, create from files with cc-knife, whatever)
- The 'users' cookbook must work correctly (comes from the Stephen Nelson-Smith book)
The first time we run this, it will fail because
* "banana" has been put into the "production" environment # teamserver/step_definitions/teamserver_steps.rb:1
undefined method `chef_environment' for nil:NilClass (NoMethodError)
/home/ubuntu/features/teamserver/step_definitions/teamserver_steps.rb:6
As far as I can tell, it fails because the node only gets saved to the server after convergence, so the search returns nothing. However when we run it again, it will pass, because the node now exists. Or maybe on the third time, or the fourth. I'm encountering some weird race condition here. But once it works, it seems to continue working.
We can then edit that feature, changing 'production' for 'staging' (or whatever other environments we've defined) and it will continue to work.
EDIT: No, doesn't work reliably. Race condition smacking me in the nuts. Bah.
Also note that * "banana" has been put into the "production" environment
has to be the last step in the Background
, otherwise the first run fails completely and the node doesn't get saved.
Hope somebody finds this useful (or it inspires somebody to bake environment support right into cucumber-chef).