2013-02-25 19:51:59 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'swift::proxy::ceilometer' do
|
|
|
|
|
|
|
|
let :pre_condition do
|
2016-11-03 09:34:14 -06:00
|
|
|
'class { "swift":
|
2016-06-02 01:13:09 -03:00
|
|
|
swift_hash_path_suffix => "dummy"
|
2013-02-25 19:51:59 +01:00
|
|
|
}'
|
|
|
|
end
|
|
|
|
|
2018-05-17 00:13:44 +02:00
|
|
|
shared_examples 'swift::proxy::ceilometer' do
|
2017-02-23 14:28:42 +02:00
|
|
|
describe "when using default parameters" do
|
2018-10-21 17:40:44 +02:00
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:default_transport_url => 'rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-05-12 22:27:12 +09:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/password').with_value('password').with_secret(true) }
|
2016-09-28 18:25:24 +00:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
|
2018-10-21 17:40:44 +02:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit').with_secret(true) }
|
2017-02-23 14:28:42 +02:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/nonblocking_notify').with_value('false') }
|
2021-02-25 11:44:26 +01:00
|
|
|
|
|
|
|
it { is_expected.to contain_package('python-ceilometermiddleware').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:name => platform_params[:ceilometermiddleware_package_name],
|
|
|
|
:tag => ['openstack', 'swift-support-package'],
|
|
|
|
)}
|
2015-11-18 18:30:35 +03:00
|
|
|
end
|
|
|
|
|
2017-02-23 14:28:42 +02:00
|
|
|
describe "when overriding default parameters with rabbit driver" do
|
|
|
|
let :params do
|
2022-07-04 01:55:22 +09:00
|
|
|
{ :default_transport_url => 'rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit',
|
2018-10-21 17:40:44 +02:00
|
|
|
:driver => 'messagingv2',
|
|
|
|
:topic => 'notifications',
|
|
|
|
:control_exchange => 'swift',
|
|
|
|
:nonblocking_notify => true,
|
2024-04-23 09:54:10 +09:00
|
|
|
:ignore_projects => ['services', 'admin'],
|
2020-02-11 23:58:58 +09:00
|
|
|
:auth_url => 'http://127.0.0.1:5000',
|
|
|
|
:auth_type => 'password',
|
|
|
|
:project_domain_name => 'Default',
|
|
|
|
:user_domain_name => 'Default',
|
|
|
|
:project_name => 'services',
|
|
|
|
:username => 'swift',
|
2020-05-12 22:27:12 +09:00
|
|
|
:password => 'mypassword',
|
2020-02-11 23:58:58 +09:00
|
|
|
:region_name => 'region2'
|
2017-02-23 14:28:42 +02:00
|
|
|
}
|
2015-11-18 18:30:35 +03:00
|
|
|
end
|
|
|
|
|
2017-02-23 14:28:42 +02:00
|
|
|
context 'with single rabbit host' do
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
|
2018-10-21 17:40:44 +02:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit').with_secret(true) }
|
2017-02-23 14:28:42 +02:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/driver').with_value('messagingv2') }
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/topic').with_value('notifications') }
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/control_exchange').with_value('swift') }
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/nonblocking_notify').with_value('true') }
|
2024-04-23 09:54:10 +09:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/ignore_projects').with_value('services,admin') }
|
2020-02-11 23:58:58 +09:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/auth_url').with_value('http://127.0.0.1:5000') }
|
2017-05-12 08:30:15 -04:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/auth_type').with_value('password') }
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/project_name').with_value('services') }
|
2022-01-25 09:58:14 +09:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/project_domain_name').with_value('Default') }
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/system_scope').with_value('<SERVICE DEFAULT>') }
|
2017-05-12 08:30:15 -04:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/username').with_value('swift') }
|
2022-01-25 09:58:14 +09:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/user_domain_name').with_value('Default') }
|
2020-05-12 22:27:12 +09:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/password').with_value('mypassword').with_secret(true) }
|
2020-02-11 23:58:58 +09:00
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/region_name').with_value('region2') }
|
2017-02-23 14:28:42 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with default transport url' do
|
|
|
|
before do
|
|
|
|
params.merge!({ :default_transport_url => 'rabbit://user:pass@host:1234/virt' })
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user:pass@host:1234/virt').with_secret(true) }
|
|
|
|
end
|
|
|
|
|
2017-03-10 13:47:48 +02:00
|
|
|
it { is_expected.to contain_oslo__messaging__rabbit('swift_proxy_config').with(
|
2022-08-09 17:49:30 +09:00
|
|
|
:rabbit_ha_queues => '<SERVICE DEFAULT>',
|
|
|
|
:heartbeat_timeout_threshold => '<SERVICE DEFAULT>',
|
|
|
|
:heartbeat_rate => '<SERVICE DEFAULT>',
|
|
|
|
:heartbeat_in_pthread => '<SERVICE DEFAULT>',
|
|
|
|
:rabbit_qos_prefetch_count => '<SERVICE DEFAULT>',
|
|
|
|
:amqp_durable_queues => '<SERVICE DEFAULT>',
|
|
|
|
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
|
|
|
|
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
|
|
|
|
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
|
|
|
|
:kombu_ssl_version => '<SERVICE DEFAULT>',
|
|
|
|
:rabbit_use_ssl => '<SERVICE DEFAULT>',
|
|
|
|
:kombu_reconnect_delay => '<SERVICE DEFAULT>',
|
|
|
|
:kombu_failover_strategy => '<SERVICE DEFAULT>',
|
|
|
|
:kombu_compression => '<SERVICE DEFAULT>',
|
2017-03-10 13:47:48 +02:00
|
|
|
)}
|
2022-08-09 17:49:30 +09:00
|
|
|
it { is_expected.to contain_oslo__messaging__amqp('swift_proxy_config') }
|
2017-02-23 14:28:42 +02:00
|
|
|
|
2018-03-23 06:03:25 +08:00
|
|
|
context 'with overridden rabbit ssl params' do
|
2017-02-23 14:28:42 +02:00
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
{
|
|
|
|
:notification_ssl_ca_file => '/etc/ca.cert',
|
|
|
|
:notification_ssl_cert_file => '/etc/certfile',
|
|
|
|
:notification_ssl_key_file => '/etc/key',
|
|
|
|
:rabbit_use_ssl => true,
|
|
|
|
:kombu_ssl_version => 'TLSv1',
|
|
|
|
})
|
|
|
|
end
|
2015-11-18 18:30:35 +03:00
|
|
|
|
2017-03-10 13:47:48 +02:00
|
|
|
it { is_expected.to contain_oslo__messaging__rabbit('swift_proxy_config').with(
|
|
|
|
:rabbit_use_ssl => true,
|
|
|
|
:kombu_ssl_ca_certs => '/etc/ca.cert',
|
|
|
|
:kombu_ssl_certfile => '/etc/certfile',
|
|
|
|
:kombu_ssl_keyfile => '/etc/key',
|
|
|
|
:kombu_ssl_version => 'TLSv1',
|
|
|
|
)}
|
2016-11-08 15:32:20 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2022-01-25 09:58:14 +09:00
|
|
|
|
|
|
|
describe 'when system_scope is set' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:default_transport_url => 'rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit',
|
|
|
|
:system_scope => 'all'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/project_name').with_value('<SERVICE DEFAULT>') }
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/project_domain_name').with_value('<SERVICE DEFAULT>') }
|
|
|
|
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/system_scope').with_value('all') }
|
|
|
|
end
|
2017-02-23 14:28:42 +02:00
|
|
|
end
|
2016-11-08 15:32:20 -07:00
|
|
|
|
2017-02-23 14:28:42 +02:00
|
|
|
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
|
2021-02-25 11:44:26 +01:00
|
|
|
|
|
|
|
let(:platform_params) do
|
2023-03-02 12:49:54 +09:00
|
|
|
case facts[:os]['family']
|
2021-02-25 11:44:26 +01:00
|
|
|
when 'Debian'
|
|
|
|
{ :ceilometermiddleware_package_name => 'python3-ceilometermiddleware' }
|
|
|
|
when 'RedHat'
|
2021-05-21 14:12:41 +02:00
|
|
|
{ :ceilometermiddleware_package_name => 'python3-ceilometermiddleware' }
|
2021-02-25 11:44:26 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-17 00:13:44 +02:00
|
|
|
it_behaves_like 'swift::proxy::ceilometer'
|
2017-02-23 14:28:42 +02:00
|
|
|
end
|
2015-05-20 18:09:58 -07:00
|
|
|
end
|
2013-02-25 19:51:59 +01:00
|
|
|
|
|
|
|
end
|