Files
cookbook-openstack-common/spec/sysctl_spec.rb
Matt Ray 1ab483c0eb Add support for openstack-common::sysctl
There are a number of sysctl settings in the OpenStack documentation that are
not managed by the cookbooks. This approach will iterate over any attributes
added to the node['openstack']['sysctl'] hash and write them out to
/etc/sysctl.d/60-openstack.conf.

The README.md had the recipe description within the Libraries section, separated
into new Recipes section.

Change-Id: Ic32184b78a0bcf4c3e704c7dcd1e9d009b1d95c6
2013-10-29 16:07:31 -05:00

35 lines
891 B
Ruby

require_relative "spec_helper"
describe "openstack-common::sysctl" do
describe "ubuntu" do
before do
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@chef_run.converge "openstack-common::sysctl"
end
describe "60-openstack.conf" do
before do
@file = @chef_run.template "/etc/sysctl.d/60-openstack.conf"
end
it "has proper owner" do
expect(@file).to be_owned_by "root", "root"
end
it "has proper modes" do
expect(sprintf("%o", @file.mode)).to eq "644"
end
it "sets the all.rp_filter" do
expect(@chef_run).to create_file_with_content @file.name,
'net.ipv4.conf.all.rp_filter = 0'
end
it "sets the default.rp_filter" do
expect(@chef_run).to create_file_with_content @file.name,
'net.ipv4.conf.default.rp_filter = 0'
end
end
end
end