Reputation: 383
I'm new to chef. Recently, I'm studying how to use chefspec to test recipe. But I always failed with "ffi-libarchive could not be loaded" error. Here's my steps.
I use gem to install chefspec -- gem install 'chefspec' It's successfully installed.
Then I write a test cookbook -- sample, with a recipe default.rb --
package 'apache2' service 'apache2' do action [:enable, :start] end
file '/srv/www/htdocs/index.html' do content '
Then in c:\work\chef-repo\cookbooks\sample\spec, I create default_spec.rb --
require 'chefspec'
describe 'index html' do let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'suse', version: '12.4').converge(described_recipe) }
it 'deletes a file with an explicit action' do
expect(chef_run).to create_file_with_content('/www/srv/index.html','Welcome! You have successfully configured your chef node.')
expect(chef_run).to_not delete_file('/tmp/e.log')
end
end
Then I tried rspec , but it failed --
C:\Work\chef-repo>rspec cookbooks\sample\spec\default_spec.rb ffi-libarchive could not be loaded, libarchive is probably not installed on system, archive_file will not be available F
Failures:
So I installed ffi-libarchive again, but the rspec still failed --
C:\Work\chef-repo>gem install 'ffi-libarchive' Successfully installed ffi-libarchive-1.1.3 Parsing documentation for ffi-libarchive-1.1.3 Done installing documentation for ffi-libarchive after 3 seconds 1 gem installed
C:\Work\chef-repo>rspec cookbooks\sample\spec\default_spec.rb ffi-libarchive could not be loaded, libarchive is probably not installed on system, archive_file will not be available
Please kind help. Thanks in advance for any idea.
Upvotes: 0
Views: 1562