btm / minitest-handler-cookbook

Apache License 2.0
59 stars 36 forks source link

Version 1.2.0 won't run tests -- but using version 1.0 all tests are executed (in the same environment) #59

Closed backslash-f closed 10 years ago

backslash-f commented 10 years ago

I can see this warning: WARN: A test file was detected at in the files directory of the cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test

But the files are in 'files/default/test'.

Is this a known issue? Do you need more information?

Thanks.

dpetzel commented 10 years ago

hrmm not a known issue, but certainly sounds less than ideal. The intention was to catch files outside the two documented directories, but sounds like that logic may not be working exactly as required. Could you give me a dir listing of 'files/default/test' so I can update the existing tests?

Also do you get this for ALL files, or just some?

dpetzel commented 10 years ago

Also Chef version might be useful if it turns out to be specific to a version of Chef.

dpetzel commented 10 years ago

One more thing to check. Do you have a file in the root of files/default that would match the pattern of *_test.rb? Looking at the code I would expect there to be some sort of file name/path after the word at. In your output above there is nothing, which is making me wonder if there is some file in the root of files/default triggering this warning?

backslash-f commented 10 years ago

Sure.

dir listing of 'files/default/test:

user@machine:~/repo/project/cookbooks$ ls -la files/default/test/ drwxrwxr-x 2 root root 4096 May 7 10:41 ./ drwxrwxr-x 5 root root 4096 May 7 10:41 ../ -rw-rw-r-- 1 root root 483 May 7 10:41 database_client.rb -rw-rw-r-- 1 root root 363 May 7 10:41 default_helper.rb -rw-rw-r-- 1 root root 463 May 7 10:41 install_cloudify_recipes_test.rb -rwxrwxr-x 1 root root 2130 May 7 10:41 integration_test_test.rb -rw-rw-r-- 1 root root 472 May 7 10:41 jackrabbit_helper.rb -rwxrwxr-x 1 root root 4963 May 7 10:41 jackrabbit_test.rb -rwxrwxr-x 1 root root 5293 May 7 10:41 webserver_test.rb

Chef version: user@machine:~$ chef-client --version Chef: 11.6.2

Also do you get this for ALL files, or just some? I'm getting the warning for all files.

Do you have a file in the root of files/default... I have two directories there: user@machine:~/repo/project/cookbooks$ ls -la files/default/ total 2 drwxr-xr-x 1 root root 0 Apr 11 13:35 . drwxr-xr-x 1 root root 0 Apr 11 13:00 .. drwxr-xr-x 1 root root 0 Apr 11 13:35 apps drwxr-xr-x 1 root root 0 Apr 11 13:35 properties drwxr-xr-x 1 root root 4096 Apr 11 13:35 test

dpetzel commented 10 years ago

Thanks for this, I'll try and repro this tonight and see what I can learn. Just to confirm you DON'T get this message for files in apps or properties, just the files in the test directory?

backslash-f commented 10 years ago

That is correct. I do NOT get the warning for files inside apps or properties. Just the files in the test directory.

Thanks for taking a look. Take your time. ;-)

dpetzel commented 10 years ago

@Conaaando I'm having trouble reproducing this. I've tested with chef client and chef solo and in both cases I'm not seeing that warning. I added all the files in your example and they were each copied into the testing directory.

Any chance you could gist the actual log messages as well as the portion of the log that starts with # Running tests:

Additionally looking at your directory structure I'm a little confused. You have a files/default in the ROOT of your cookbooks directory as opposed to in an actual cookbook? IE user@machine:~/repo/project/cookbooks$ ls -la files/default/ rather than user@machine:~/repo/project/cookbooks/my_cookbook$ ls -la files/default/

backslash-f commented 10 years ago

Hey, @dpetzel. Mm, ok. Well, it may be something related to this environment, then.

I can't past the entire log because it's triggered by Jenkins in a huge pipeline. But I can paste here some snippets related to it (below).

Regarding the directory structure, here is the output of the 'tree' command:

tree

Do you think this structure can be a problem? (I just want to reinforce that it works fine in version 1.0)

Log
<ip> [2014-05-15T03:33:30+00:00] WARN: A test file was detected at database_client.rb in the files directory of the crs cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test/
<ip> [2014-05-15T03:33:30+00:00] WARN: A test file was detected at default_helper.rb in the files directory of the crs cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test/
<ip> [2014-05-15T03:33:30+00:00] WARN: A test file was detected at install_cloudify_recipes_test.rb in the files directory of the crs cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test/
<ip> [2014-05-15T03:33:30+00:00] WARN: A test file was detected at integration_test_test.rb in the files directory of the crs cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test/
<ip> [2014-05-15T03:33:30+00:00] WARN: A test file was detected at jackrabbit_helper.rb in the files directory of the ccpbase cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test/
<ip> [2014-05-15T03:33:30+00:00] WARN: A test file was detected at jackrabbit_test.rb in the files directory of the haproxy-hp cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test/
<ip> [2014-05-15T03:33:30+00:00] WARN: A test file was detected at webserver_test.rb in the files directory of the haproxy-hp cookbook. As of version 1.2.0 of the minitest-handler-cookbook storing test files in this location is not supported. If you would like these tests executed you should move them into files/default/test/

<ip> # Running tests:
<ip> Finished tests in 0.000690s, 0.0000 tests/s, 0.0000 assertions/s.
<ip> 0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

Thanks, man!

dpetzel commented 10 years ago

@Conaaando Totally understand it was working before, and I do believe its a bug in the cookbook, I just need to figure out where :)

Is this under chef-solo or chef-client? Do you happen to know what your cookbook path configuration (perhaps defined in your knife.rb) is?

Can you turn on debug logging and look for lines like: "Not copying test files for recipe"

backslash-f commented 10 years ago

That's ok. :-)

It's under chef-client.

We don't use a cookbook path configuration and / or Knife. We use Berkshelf. This is interesting and may help -- reading the instructions at Berkshelf.com, it says:

##### Chef Solo provisioner
The Chef Solo provisioner’s cookbook_path attribute is hijacked when using the Vagrant Berkshelf plugin.
Cookbooks resolved from your Berksfile will automatically be made available to your Vagrant virtual machine.
There is no need to explicitly set a value for cookbook_path attribute.

##### Chef Client provisioner
Cookbooks will automatically be uploaded to the Chef Server you have configured in the Vagrantfile’s Chef Client provisioner block.
Your Berkshelf configuration’s chef.node_name and chef.client_key credentials will be used to authenticate the upload.

Not sure if the hijack thing applies to chef-client too... But it seems to be the case, since we do not configure a cookbook_path.

Another detail that may help: we use a Hosted Chef server (enterprise Chef). I'm not sure if this is relevant, tho.

Thanks.

dpetzel commented 10 years ago

Thanks @Conaaando If you could do a run with debug logging and look for "Not copying test files for recipe" it would be a great help. If that doesn't. I've tested with Chef client and chef_zero, but not an enterprise chef installation. Its got to be something simple/silly, just a matter of weeding it out :)

Are you in a position where you print your cookbook during the run so we could confirm what it is?

dpetzel commented 10 years ago

The plot thickens. I just ran this against enterprise Chef and and Chef 11.8.0 and still couldn't reproduce it.

Maybe a silly question, but I'm running out of ideas. That dir structure you sent me is what is in your SCM repo (before the CI run)? Can you look at your jenkins workspace and if somehow these files are getting moved into into files/default?

backslash-f commented 10 years ago

That's really weird... It must be something simple, like you said. :-) The issue happens in my workplace. I will get back to you on Monday. Thanks for all your help. Have a great weekend.

backslash-f commented 10 years ago

Hi, @dpetzel. So here is the thing: I won't be able to investigate this issue any further this week. As a workaround, we are going to use version 1.0, which works fine. This may be a specific environment issue, since you are not able to reproduce. I suggest us to close this bug for now. If I happen to find out more info, I can reopen it. Does that sound good? Meanwhile, I appreciate your help. Thanks.

dpetzel commented 10 years ago

@Conaaando Seems fair.

johnsmyth commented 10 years ago

Have you resolved this issue?

I'm seeing this same behavior. When I run via vagrant & chef-solo, everything runs fine, all the tests are loaded and execute as expected. I berks jupload this exact cookbook to the chef server, and when running the the chef client using Chef Server, the tests do not run, and I get the warnings about moving the tests to files/default/test (which is where the tests are). Any ideas?