puppet-neutron/spec/classes/neutron_designate_spec.rb
Thomas Goirand 1d5702d273 designate region_name param
The class neutron::designate didn't have a region_name parameter.
In our deployment, this was an issue we had to fix.

Change-Id: Ifde81be654ca73cb88515804b38a6e053f1409ac
2024-12-03 10:55:45 +01:00

105 lines
5.1 KiB
Ruby

require 'spec_helper'
describe 'neutron::designate' do
let :req_params do
{ :password => 'secret',
:url => 'http://ip/designate' }
end
shared_examples 'neutron designate' do
context 'with default parameters' do
let :params do
req_params
end
it 'configures designate in neutron.conf' do
should contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
should contain_neutron_config('designate/url').with_value('http://ip/designate')
should contain_neutron_config('designate/password').with_value('secret').with_secret(true)
should contain_neutron_config('designate/auth_type').with_value('password')
should contain_neutron_config('designate/username').with_value('neutron')
should contain_neutron_config('designate/user_domain_name').with_value('Default')
should contain_neutron_config('designate/project_name').with_value('services')
should contain_neutron_config('designate/project_domain_name').with_value('Default')
should contain_neutron_config('designate/system_scope').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/auth_url').with_value('http://127.0.0.1:5000')
should contain_neutron_config('designate/cafile').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/certfile').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/region_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/allow_reverse_dns_lookup').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/ipv4_ptr_zone_prefix_size').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/ipv6_ptr_zone_prefix_size').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/ptr_zone_email').with_value('<SERVICE DEFAULT>')
end
end
context 'with provided parameters' do
let :params do
req_params.merge!({
:auth_type => 'v3password',
:username => 'alt_neutron',
:user_domain_name => 'Domain2',
:project_name => 'alt_service',
:project_domain_name => 'Domain1',
:auth_url => 'http://localhost:5000',
:cafile => '/path/to/cafile',
:certfile => '/path/to/certfile',
:region_name => 'region2',
:allow_reverse_dns_lookup => false,
:ipv4_ptr_zone_prefix_size => 765,
:ipv6_ptr_zone_prefix_size => 876,
:ptr_zone_email => 'foo@example.com'
})
end
it 'configures designate in neutron.conf' do
should contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
should contain_neutron_config('designate/url').with_value('http://ip/designate')
should contain_neutron_config('designate/password').with_value('secret').with_secret(true)
should contain_neutron_config('designate/auth_type').with_value('v3password')
should contain_neutron_config('designate/username').with_value('alt_neutron')
should contain_neutron_config('designate/user_domain_name').with_value('Domain2')
should contain_neutron_config('designate/project_name').with_value('alt_service')
should contain_neutron_config('designate/project_domain_name').with_value('Domain1')
should contain_neutron_config('designate/system_scope').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/auth_url').with_value('http://localhost:5000')
should contain_neutron_config('designate/cafile').with_value('/path/to/cafile')
should contain_neutron_config('designate/certfile').with_value('/path/to/certfile')
should contain_neutron_config('designate/region_name').with_value('region2')
should contain_neutron_config('designate/allow_reverse_dns_lookup').with_value(false)
should contain_neutron_config('designate/ipv4_ptr_zone_prefix_size').with_value(765)
should contain_neutron_config('designate/ipv6_ptr_zone_prefix_size').with_value(876)
should contain_neutron_config('designate/ptr_zone_email').with_value('foo@example.com')
end
end
context 'with system_scope' do
let :params do
req_params.merge!({
:project_name => 'proj',
:project_domain_name => 'Domain1',
:system_scope => 'all',
})
end
it 'configures designate in neutron.conf' do
should contain_neutron_config('designate/project_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/project_domain_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/system_scope').with_value('all')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'neutron designate'
end
end
end