Dear Chefs,
I have significantly refactored the minitest-handler-cookbook and
added tests using test-kitchen 1.0 + kitchen-lxc driver.
https://github.com/btm/minitest-handler-cookbook/tree/refactor
In this refactoring i have done my done my best to clean up the code
and simplify its use. My changes are backwards compatible so current
use should not break. I wrote parts of the minitest-handler cookbook
before knowing much about existing ruby testing practices. For this
reason the cookbook was unnecessarily complicated.
Old Convention:
place your tests in files/default/tests/minitest/_test.rb
and support files in files/default/tests/minitest/support/
About 70% of the time I place my tests in the wrong directory and
misname them. My fingers also tire from typing these long paths. For
this reason I have changed the convention.
New Convention:
Place your tests in files/default/_test.rb and support
files in files/default/
For example, put tests for the default recipe in
files/default/default_test.rb and your helper file in
files/default/spec_helper.rb
In the new branch, minitest-handler will still copy files located in
files/default/tests/minitest/ and files/default/tests/minitest/support
I would really prefer to put such tests in test/ or test/minitest/
but then these files would not be uploaded to chef-server. I have
opened this ticket http://tickets.opscode.com/browse/CHEF-4044 to
change this but I haven’t seen any progress on it yet.
New Feature:
By default, minitest-handler will load all test files for each recipe
loaded during the chef run, whether via the run_list, through a role,
or include_recipe. You can tell minitest-handler to only load tests
for certain recipes using the node[:minitest][:recipes] attribute. If
that attribute is non-empty, minitest-handler will only execute the
tests specified in that list.
Call for Testing:
I have only tested this new branch w/ ubuntu linux. I could really use
testing help to ensure that recipes loaded through a role are tested
and to test this cookbook on Windows.
If I don’t hear of any major issues on this branch, I will merge it
into master early next week and push it to community.opscode.com