btm / minitest-handler-cookbook

Apache License 2.0
59 stars 36 forks source link

[Possibly PEBCAK] Minitest-handler not copying all tests to local filesystem #23

Closed bmhatfield closed 11 years ago

bmhatfield commented 12 years ago

I have downloaded the OpsCode community cookbook to manage Chef Client. In that cookbook are some minitest tests, in the following hierarchy:

[bhatfield@bhatfield-mac chef-client]$ tree files/
files/
└── [Oct  3 12:09]  default/
    └── [Oct  3 12:09]  tests/
        └── [Oct  3 12:09]  minitest/
            ├── [Oct  3 12:09]  config_test.rb
            ├── [Oct  3 12:09]  cron_test.rb
            ├── [Oct  3 12:09]  delete_validation_test.rb
            ├── [Oct  3 12:09]  helpers.rb
            └── [Oct  3 12:09]  service_test.rb

Within the given tests, there is a cross dependency on helpers.rb, like so:

[bhatfield@bhatfield-mac chef-client]$ cat files/default/tests/minitest/service_test.rb 
require File.expand_path('../helpers', __FILE__)

describe 'chef-client::service' do
  include Helpers::ChefClient
  it "starts the chef-client service" do
    service("chef-client").must_be_running
  end
end

However, when running chef-client with minitest handler enabled, I get the following error:

ERROR: Report handler MiniTest::Chef::Handler raised #<LoadError: cannot load such file -- /var/chef/minitest/chef-client/helpers>

This was confusing to me, so I troubleshooted the 'require' code above, and determined that the file was not actually there, which is confirmed on the host:

 vagrant@vagrant-ubuntu-oneric:/var/chef/minitest$ tree chef-client/
 chef-client/
 ├── config_test.rb
 ├── delete_validation_test.rb
 └── service_test.rb

I am having a hard time understanding how I am getting into this state. What can I do to provide more troubleshooting data? Is there something I am not understanding about minitest-handler?

jimhopp commented 12 years ago

Brian, minitest-handler-cookbook copies the files to the host (defaulting to /var/chef/minitest). It looks like it expects support files to be in ../support, not ../helpers. See https://github.com/btm/minitest-handler-cookbook/blob/master/recipes/default.rb

bryanwb commented 12 years ago

should the helpers be in ./helpers instead of ./support?

i wrote that code but I am a novice when it comes to ruby testing

On Thu, Oct 4, 2012 at 4:34 PM, Jim Hopp notifications@github.com wrote:

Brian, minitest-handler-cookbook copies the files to the host (defaulting to /var/chef/minitest). It looks like it expects support files to be in ../support, not ../helpers. See https://github.com/btm/minitest-handler-cookbook/blob/master/recipes/default.rb

— Reply to this email directly or view it on GitHubhttps://github.com/btm/minitest-handler-cookbook/issues/23#issuecomment-9143338.

jimhopp commented 12 years ago

I haven't used helpers in my tests so I can't answer definitively. I think you have two choices: modify the minitest-handler-cookbook to upload minitests/helpers, or move your helper code to support/.

On Thu, Oct 4, 2012 at 7:41 AM, Bryan Berry notifications@github.comwrote:

should the helpers be in ./helpers instead of ./support?

i wrote that code but I am a novice when it comes to ruby testing

On Thu, Oct 4, 2012 at 4:34 PM, Jim Hopp notifications@github.com wrote:

Brian, minitest-handler-cookbook copies the files to the host (defaulting to /var/chef/minitest). It looks like it expects support files to be in ../support, not ../helpers. See

https://github.com/btm/minitest-handler-cookbook/blob/master/recipes/default.rb

— Reply to this email directly or view it on GitHub< https://github.com/btm/minitest-handler-cookbook/issues/23#issuecomment-9143338>.

— Reply to this email directly or view it on GitHubhttps://github.com/btm/minitest-handler-cookbook/issues/23#issuecomment-9143643.

bscott commented 12 years ago

I would recommend using support/

jimhopp commented 12 years ago

Sorry, I wasn't paying attention to the sender (Bryan vs. Brian)!

On Thu, Oct 4, 2012 at 1:58 PM, Brian Scott notifications@github.comwrote:

I would recommend using support/

— Reply to this email directly or view it on GitHubhttps://github.com/btm/minitest-handler-cookbook/issues/23#issuecomment-9156876.

bscott commented 12 years ago

Did get your issue resolved @jimhopp ?

dpetzel commented 11 years ago

I believe there isn't an actionable task here. There has been no activity in a year, and I think the documentation covers where the acceptable places for support files are. If there is an actionable task here report back and we'll reopen this.