私のレシピでは、dynatrace モジュールをインストールして有効にします。
include_recipe 'dynatrace::wsagent_package'
apache2_module 'dtagent_module' do
module_name 'dtagent_module'
filepath node['dynatrace']['apache_wsagent']['linux']['agent_path']
action [:enable]
end
私の仕様ファイルには次のものが含まれています。
it 'creates /opt/dynatrace/agent/lib64/libdtagent.so file' do
expect(chef_run).to render_file('/opt/dynatrace/agent/lib64/libdtagent.so')
end
Rspec を実行すると、次のエラーで失敗します。
$ 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 to 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 to 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
仕様の失敗の原因となっている問題を特定するのに助けが必要です。