apache - Rspec failing with Untouched resources -


my recipe installs dynatrace module , enables it:

include_recipe 'dynatrace::wsagent_package'  apache2_module 'dtagent_module'   module_name 'dtagent_module'   filepath node['dynatrace']['apache_wsagent']['linux']['agent_path']   action [:enable] end 

my spec file contains following:

  'creates /opt/dynatrace/agent/lib64/libdtagent.so file'     expect(chef_run).to render_file('/opt/dynatrace/agent/lib64/libdtagent.so')   end 

when run rspec fails following error:

$ rspec -f d ./spec/unit/recipes/apache_spec.rb[1:4]  run options: `include {:ids=>{"./spec/unit/recipes/apache_spec.rb"=>["1:4"]}}`  dynatrace::apache   creates /opt/dynatrace/agent/lib64/libdtagent.so file (failed - 1)  failures:    1) dynatrace::apache creates /opt/dynatrace/agent/lib64/libdtagent.so file      failure/error: expect(chef_run).to render_file('/opt/dynatrace/agent/lib64/libdtagent.so')        expected chef run render "/opt/dynatrace/agent/lib64/libdtagent.so"      # ./spec/unit/recipes/apache_spec.rb:35:in `block (2 levels) in <top (required)>'  finished in 1.13 seconds (files took 8.93 seconds load) 1 example, 1 failure  failed examples:  rspec ./spec/unit/recipes/apache_spec.rb:34 # dynatrace::apache creates /opt/dynatrace/agent/lib64/libdtagent.so file   chefspec coverage report generated...    total resources:   1   touched resources: 0   touch coverage:    0.0%  untouched resources:    apache2_module[dtagent_module]     dynatrace/recipes/apache.rb:12   chefspec coverage report generated...    total resources:   1   touched resources: 0   touch coverage:    0.0%  untouched resources:    apache2_module[dtagent_module]     dynatrace/recipes/apache.rb:12 

need in identifying issue causing spec failure.

from description, issue isn't failing due untouched resources.

your chefspec run has failed no resource in chef run creates file /opt/dynatrace/agent/lib64/libdtagent.so

from looks of https://github.com/dynatrace/dynatrace-chef/blob/master/recipes/wsagent_package.rb , recipe being included might create file via extraction of archive/tar. side effect, can't directly tested using unit tests.

it seems writing wrapper cookbook glue 2 pieces of functionality together.

a tool such test kitchen serverspec might better suited integration test writing.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -