Pergunta

I am followig the Anatomy of a Test Kitchen 1.0 Cookbook tutorial, and kitchen report me some errors.

I create a simple cookbook called tty to proof a kitchen test.

roberto@rcisla-pc:~/Desktop/opscode/cookbooks/tty$ kitchen test
-----> Starting Kitchen (v1.1.1)
-----> Cleaning up any prior instances of <default-ubuntu-1204>
-----> Destroying <default-ubuntu-1204>...
       [default] Forcing shutdown of VM...
       [default] Destroying VM and associated drives...
       Vagrant instance <default-ubuntu-1204> destroyed.
       Finished destroying <default-ubuntu-1204> (0m22.80s).
-----> Testing <default-ubuntu-1204>
-----> Creating <default-ubuntu-1204>...
       Bringing machine 'default' up with 'virtualbox' provider...
       [default] Importing base box 'ubuntu-12.04'...
       [default] Matching MAC address for NAT networking...
       [default] Setting the name of the VM...
       [default] Clearing any previously set forwarded ports...
       [Berkshelf] Skipping Berkshelf with --no-provision
       [default] Fixed port collision for 22 => 2222. Now on port 2201.
       [default] Creating shared folders metadata...
       [default] Clearing any previously set network interfaces...
       [default] Preparing network interfaces based on configuration...
       [default] Forwarding ports...
       [default] -- 22 => 2201 (adapter 1)
       [default] Running 'pre-boot' VM customizations...
       [default] Booting VM...
       [default] Waiting for machine to boot. This may take a few minutes...
       [default] Machine booted and ready!
       [default] Setting hostname...
       [default] Mounting shared folders...
       Vagrant instance <default-ubuntu-1204> created.
       Finished creating <default-ubuntu-1204> (2m10.60s).
-----> Converging <default-ubuntu-1204>...
       Preparing files for transfer
       Resolving cookbook dependencies with Berkshelf...
       Removing non-cookbook files before transfer
       Transfering files to <default-ubuntu-1204>
[2014-01-20T18:20:35+00:00] INFO: Forking chef instance to converge...       
Starting Chef Client, version 11.8.2       
[2014-01-20T18:20:35+00:00] INFO: *** Chef 11.8.2 ***       
[2014-01-20T18:20:35+00:00] INFO: Chef-client pid: 1194       
[2014-01-20T18:20:37+00:00] INFO: Setting the run_list to ["recipe[minitest-handler]", "recipe[tty_test]"] from JSON       
[2014-01-20T18:20:37+00:00] INFO: Run List is [recipe[minitest-handler], recipe[tty_test]]       
[2014-01-20T18:20:37+00:00] INFO: Run List expands to [minitest-handler, tty_test]       
[2014-01-20T18:20:37+00:00] INFO: Starting Chef Run for default-ubuntu-1204       
[2014-01-20T18:20:37+00:00] INFO: Running start handlers       
[2014-01-20T18:20:37+00:00] INFO: Start handlers complete.       
Compiling Cookbooks...       
Recipe: minitest-handler::default       
  * chef_gem[minitest] action nothing[2014-01-20T18:20:37+00:00] INFO: Processing chef_gem[minitest] action nothing (minitest-handler::default line 6)       
 (skipped due to action :nothing)       
  * chef_gem[minitest] action install[2014-01-20T18:20:37+00:00] INFO: Processing chef_gem[minitest] action install (minitest-handler::default line 6)       
 (skipped due to only_if)       
  * chef_gem[minitest-chef-handler] action nothing[2014-01-20T18:20:37+00:00] INFO: Processing chef_gem[minitest-chef-handler] action nothing (minitest-handler::default line 13)       
 (skipped due to action :nothing)       
  * chef_gem[minitest-chef-handler] action install[2014-01-20T18:20:37+00:00] INFO: Processing chef_gem[minitest-chef-handler] action install (minitest-handler::default line 13)       
       [2014-01-20T18:21:41+00:00] INFO: Retrying execution of chef_gem[minitest-chef-handler], 0 attempt(s) left

       ================================================================================
       Error executing action `install` on resource 'chef_gem[minitest-chef-handler]'
       ================================================================================


       NoMethodError
       -------------
       undefined method `full_name' for nil:NilClass


       Cookbook Trace:
       ---------------
       /tmp/kitchen/cookbooks/minitest-handler/recipes/default.rb:24:in `from_file'


       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cookbooks/minitest-handler/recipes/default.rb

        13: chef_gem "minitest-chef-handler" do
        14:   version node[:minitest][:chef_handler_gem_version]
        15:   action :nothing
        16:   # I won't pretend I understand WHY this works, but since the release of
        17:   # Chef 11.8, this was causing errors related to the PUMA Gem
 18:   # http://lists.opscode.com/sympa/arc/chef/2013-10/msg00592.html       
 19:   # I tried using the conservative flag, as well as a few other hacks       
 20:   # but for whatever reason, simply retrying once works. The initial       
 21:   # attempt still fails with the error in that thread, however       
 22:   # the retry succeeds...       
 23:   retries 1       
 24: end.run_action(:install)       
 25:        
 26: Gem.clear_paths       
 27: # Ensure minitest gem is utilized       
 28: require "minitest-chef-handler"       
 29:        
 30: scratch_dir = ::File.join(Chef::Config[:file_cache_path], "minitest_scratch")       
 31:        
 32: [:delete, :create].each do |action|       
 33:   directory "#{action} minitest test location" do       
 34:     path node[:minitest][:path]       
 35:     owner node[:minitest][:owner]       
 36:     group node[:minitest][:group]       
 37:     mode node[:minitest][:mode]       
 38:     recursive true       
 39:     action action       
 40:   end       
 41:          
        42:   directory "#{action} #{scratch_dir}" do
        43:     path scratch_dir
        44:     owner node[:minitest][:owner]
        45:     group node[:minitest][:group]

        46:     mode node[:minitest][:mode]
        47:     recursive true
        48:     action action
        49:   end
        50: end
        51: 

        52: # Search through all cookbooks in the run list for tests

        53: ruby_block "load tests" do
        54:   block do

 55:     # Leverage the library code to load the test files       
 56:     load_tests(scratch_dir)       
 57:   end       
 58: end       



Compiled Resource:       
------------------       
# Declared in /tmp/kitchen/cookbooks/minitest-handler/recipes/default.rb:13:in `from_file'       

chef_gem("minitest-chef-handler") do       
  provider Chef::Provider::Package::Rubygems       
  action [:nothing]       
  retries 0       
  retry_delay 2       
  package_name "minitest-chef-handler"       
  version "1.0.1"       
  cookbook_name :"minitest-handler"       
  recipe_name "default"       
end       




================================================================================       
Recipe Compile Error in /tmp/kitchen/cookbooks/minitest-handler/recipes/default.rb       
================================================================================       


NoMethodError       
-------------       
chef_gem[minitest-chef-handler] (minitest-handler::default line 13) had an error: NoMethodError: undefined method `full_name' for nil:NilClass       


Cookbook Trace:       
---------------       
  /tmp/kitchen/cookbooks/minitest-handler/recipes/default.rb:24:in `from_file'       


Relevant File Content:       
----------------------       
/tmp/kitchen/cookbooks/minitest-handler/recipes/default.rb:       

 17:    # Chef 11.8, this was causing errors related to the PUMA Gem       
 18:    # http://lists.opscode.com/sympa/arc/chef/2013-10/msg00592.html       
 19:    # I tried using the conservative flag, as well as a few other hacks       
 20:    # but for whatever reason, simply retrying once works. The initial       
 21:    # attempt still fails with the error in that thread, however       
 22:    # the retry succeeds...       
 23:    retries 1       
 24>> end.run_action(:install)       
 25:         
 26:  Gem.clear_paths       
 27:  # Ensure minitest gem is utilized       
 28:  require "minitest-chef-handler"       
 29:         
 30:  scratch_dir = ::File.join(Chef::Config[:file_cache_path], "minitest_scratch")       
 31:         
 32:  [:delete, :create].each do |action|       
 33:    directory "#{action} minitest test location" do       



[2014-01-20T18:22:46+00:00] ERROR: Running exception handlers       
[2014-01-20T18:22:46+00:00] ERROR: Exception handlers complete       
[2014-01-20T18:22:46+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out       
Chef Client failed. 0 resources updated       
[2014-01-20T18:22:46+00:00] ERROR: chef_gem[minitest-chef-handler] (minitest-handler::default line 13) had an error: NoMethodError: undefined method `full_name' for nil:NilClass       
[2014-01-20T18:22:46+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)       
>>>>>> Converge failed on instance <default-ubuntu-1204>.
>>>>>> Please see .kitchen/logs/default-ubuntu-1204.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json  --log_level info]
>>>>>> ----------------------
roberto@rcisla-pc:~/Desktop/opscode/cookbooks/tty$

and this is my .kitchen.yml configuration.

---
driver:
  name: vagrant

    provisioner:
      name: chef_solo

    platforms:
      - name: ubuntu-12.04
        driver_config:
          box: "ubuntu-12.04"

    suites:
      - name: default
        run_list:
          - recipe[minitest-handler]
          - recipe[tty_test]
        attributes:

anyone knows what is wrong???

Foi útil?

Solução

ok, i resolved the problem... I had a wrong structure of my minitest folders, where kitchen are looking for test. There is nothing to report to GitHub yet.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top