I'm trying to write serverspec tests that check if a recipe is setting up mariadb-server, by using chef, kitchen, and vagrant, with a debian jessie box.
The recipe is simple:
# cookbooks/mariadb/recipes/server.rb
package 'mariadb-server' do
action :install
end
The spec for it I wrote is:
# cookbooks/mariadb/test/integration/default/serverspec/server_spec.rb
require 'spec_helper'
describe 'mariadb::server' do
context package('mariadb-server') do
it 'is installed' do
expect be_installed
end
end
end
However, when running kitchen verify
, this always returns true, regardless of the package state. If I ssh into the vagrant box and remove the package, then run kitchen verify
, I'm also getting a posive result.
Even if I change the package to some random string, e.g. context package('this-is-not-a-package') do
the test result is true.
What am I doing wrong here?