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
This commit is contained in:
parent
6e9795790c
commit
a69421e1c4
@ -32,23 +32,26 @@ describe 'openstack-common::ceph_client' do
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates the /etc/ceph/ceph.conf file' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
owner: 'root',
|
||||
group: 'root',
|
||||
mode: '644'
|
||||
)
|
||||
end
|
||||
context 'configuration file' do
|
||||
it 'creates the file' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
owner: 'root',
|
||||
group: 'root',
|
||||
mode: '644'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures ceph.conf' do
|
||||
[/^\[global\]$/,
|
||||
/^fsid = 9e5038a9-4329-4cad-8c24-0813a49d1125$/,
|
||||
/^mon_initial_members = 10.0.1.10, 10.0.1.20$/,
|
||||
/^mon_hosts = mon01, mon02$/].each do |content|
|
||||
expect(chef_run).to render_file(file.name).with_content(content)
|
||||
it 'sets file contents from the global ceph configuration attributes' do
|
||||
node.set['openstack']['ceph']['global'] = {
|
||||
'key_1' => %w(value_1_1 value_1_2),
|
||||
'key_2' => 'value_2'
|
||||
}
|
||||
[/^key_1 = value_1_1, value_1_2$/,
|
||||
/^key_2 = value_2$/].each do |content|
|
||||
expect(chef_run).to render_file(file.name).with_content(content)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when setup_client is not set' do
|
||||
let(:chef_run) do
|
||||
node.set['openstack']['ceph']['setup_client'] = false
|
||||
|
@ -32,19 +32,34 @@ describe 'openstack-common::logging' do
|
||||
expect(sprintf('%o', file.mode)).to eq '644'
|
||||
end
|
||||
|
||||
it 'templates openstack.logging.ignore block' do
|
||||
node.set['openstack']['logging']['ignore'] = {
|
||||
'test.nova.api.openstack.wsgi' => 'WARNING'
|
||||
}
|
||||
context 'logging ignore' do
|
||||
it 'adds loggers keys ignore' do
|
||||
node.set['openstack']['logging']['ignore'] = {
|
||||
'ignore.key.1' => 'ignore.value.1',
|
||||
'ignore.key.2' => 'ignore.value.2'
|
||||
}
|
||||
[
|
||||
/^\[loggers\]$/,
|
||||
/^keys=.*ignore_key_1,ignore_key_2$/
|
||||
].each do |content|
|
||||
expect(chef_run).to render_file(file.name).with_content(content)
|
||||
end
|
||||
end
|
||||
|
||||
tmp = [
|
||||
'[logger_test_nova_api_openstack_wsgi]',
|
||||
'level = WARNING',
|
||||
'handlers = prod,debug',
|
||||
'qualname = test.nova.api.openstack.wsgi'
|
||||
]
|
||||
expect(chef_run).to render_file(file.name).with_content(tmp.join('
|
||||
'))
|
||||
it 'adds specific logger ignore block' do
|
||||
node.set['openstack']['logging']['ignore'] = {
|
||||
'test.nova.api.openstack.wsgi' => 'WARNING'
|
||||
}
|
||||
|
||||
[
|
||||
/^\[logger_test_nova_api_openstack_wsgi\]$/,
|
||||
/^level = WARNING$/,
|
||||
/^handlers = prod,debug$/,
|
||||
/^qualname = test.nova.api.openstack.wsgi$/
|
||||
].each do |content|
|
||||
expect(chef_run).to render_file(file.name).with_content(content)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -19,10 +19,12 @@ describe 'openstack-common::sysctl' 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}")
|
||||
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
|
||||
|
@ -1,3 +0,0 @@
|
||||
[client.<%= @name -%>]
|
||||
key = <%= @key %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user