Files
cookbook-openstack-common/spec/sysctl_spec.rb
Federico Gimenez Nieto a69421e1c4 Added missing tests and checked existing ones
Some of the tests have been modified to set the implied
attributes to known values before verifying the
expectations. The ceph.client.keyring.erb template has
been deleted, any recipe was using it.

Change-Id: Ic1e5c67015290f677628d2705474d192d1d2c6dc
Closes-Bug: #1300774
2014-04-02 21:25:17 +02:00

33 lines
948 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
it 'sets the sysctl attributes' do
sysctl_kv = { 'systcl_key1' => 'sysctl_value1',
'sysctl_key2' => 'sysctl_value2' }
node.set['openstack']['sysctl'] = sysctl_kv
sysctl_kv.each do |k, v|
expect(chef_run).to render_file(file.name).with_content(/^#{k} = #{v}$/)
end
end
end
end
end