chef-boneyard / minitest-chef-handler

Run minitest suites after your Chef recipes to check the status of your system.
Other
163 stars 44 forks source link

Add report to the exception so other handlers can use it #42

Closed juanje closed 11 years ago

juanje commented 11 years ago

This add a bit more of information to the exception with may be useful for others handlers.

If you're using others handlers (e.g. chef-handler-mail, chef-handler-s3...) to send or store the reports elsewhere, right now you don't get any information about which test has fail. Adding this line the you can use the run_status.exception or the run_status.formatted_exception to see wich test did fail.

For example, instead of have this run_status.formatted_exception:

RuntimeError: MiniTest failed with 1 failure(s) and 0 error(s).

You could have something like this:

MiniTest failed with 2 failure(s) and 0 error(s).
Failure:
test_0002_must_own_to_the_root(recipe::spec_examples::default::config file::only the root can modify the config file) [/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/minitest-chef-handler-0.6.4/lib/minitest-chef-handler/resources.rb:41]:
The file does not have the expected owner.
Expected: "oot"
  Actual: "root"

Much more useful. I hope you like it and thanks for this great handler :smile:

calavera commented 11 years ago

Sounds good to me, I'll release a new version with this change as soon as possible. Thank you!

calavera commented 11 years ago

I'm really sorry, I totally forgot to release a new version. I just pushed 0.6.5. Thanks again for your contribution.

juanje commented 11 years ago

That's great! This will be very useful to me right now. Thanks :smile: