Files
cookbook-openstack-common/spec/sysctl_spec.rb
galstrom21 ffe0d05a0d Refactoring chefspec tests
Change-Id: I35dfca684039512e2a238466ff7df5f3fd34d956
Addresses: blueprint refactor-spec-files
Closes-Bug: 1282996
2014-02-26 20:05:04 -06:00

31 lines
845 B
Ruby

# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-common::sysctl' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
describe '60-openstack.conf' do
let(:file) { chef_run.template('/etc/sysctl.d/60-openstack.conf') }
it 'has proper owner' do
expect(file.owner).to eq('root')
expect(file.group).to eq('root')
end
it 'has proper modes' do
expect(sprintf('%o', file.mode)).to eq '644'
end
{ 'net.ipv4.conf.all.rp_filter' => 0,
'net.ipv4.conf.default.rp_filter' => 0 }.each do |k, v|
it "sets the #{k}" do
expect(chef_run).to render_file(file.name).with_content("#{k} = #{v}")
end
end
end
end
end