Files
puppet-sahara/spec/classes/sahara_notify_rabbitmq_spec.rb
Sebastien Badia a0f14ef9dd Rewrite puppet-sahara from scratch
During the Kilo summit, we talked about the state of the current
puppet-sahara module on stackforge, and especially about the brought up parity with
other modules.

For theses reasons, the rewrite was launched/leaded by Robbie Harwood,
but directly coded on Github (and not in a feature branch in this
repository), for this reason, this patch is non-atomic, and import the
latest frozencemetery/puppet-sahara version¹.

This rewrite/import was approved on puppet-openstack mailing list
(following this thread²).

The «reset» of the stackforge repo was discussed (in order to keep the history
of Robbie module) on #openstack-infra, but it seems we have no simple solution.

¹05af265b15
²https://groups.google.com/a/puppetlabs.com/forum/#!topic/puppet-openstack/0BETdNvrd70

Co-Authored-By: Robbie Harwood <rharwood@redhat.com>
Change-Id: Ic3dd7547fdfcba275d8a8b90b8ba84bc3ce1d7c0
2015-02-05 20:40:12 +01:00

121 lines
5.1 KiB
Ruby

require 'spec_helper'
describe 'sahara::notify::rabbitmq' do
let :facts do
{
:osfamily => 'Debian'
}
end
describe 'when defaults with rabbit pass specified' do
let :params do
{:rabbit_password => 'pass'}
end
it { should contain_sahara_config('DEFAULT/rabbit_password').with_value('pass') }
it { should contain_sahara_config('DEFAULT/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) }
it { should contain_sahara_config('DEFAULT/rabbit_userid').with_value('guest') }
it { should contain_sahara_config('DEFAULT/rabbit_host').with_value('localhost') }
it { should contain_sahara_config('DEFAULT/rabbit_port').with_value('5672') }
xit { should contain_sahara_config('DEFAULT/rabbit_hosts').with_value('localhost:5672') }
it { should contain_sahara_config('DEFAULT/rabbit_ha_queues').with_value('false') }
it { should contain_sahara_config('DEFAULT/amqp_durable_queues').with_value('false') }
it { should contain_sahara_config('DEFAULT/rabbit_virtual_host').with_value('/') }
it { should contain_sahara_config('DEFAULT/control_exchange').with_value('openstack') }
it { should contain_sahara_config('DEFAULT/notification_topics').with_value('notifications') }
end
describe 'when passing params' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_userid => 'guest2',
:rabbit_host => 'localhost2',
:rabbit_port => '5673',
:durable_queues => true,
}
it { should contain_sahara_config('DEFAULT/rabbit_userid').with_value('guest2') }
it { should contain_sahara_config('DEFAULT/rabbit_host').with_value('localhost2') }
it { should contain_sahara_config('DEFAULT/rabbit_port').with_value('5673') }
it { should contain_sahara_config('DEFAULT/rabbit_durable_queues').with_value('true') }
end
end
describe 'with rabbit ssl cert parameters' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_use_ssl => 'true',
:kombu_ssl_ca_certs => '/etc/ca.cert',
:kombu_ssl_certfile => '/etc/certfile',
:kombu_ssl_keyfile => '/etc/key',
}
end
it { should contain_sahara_config('DEFAULT/rabbit_use_ssl').with_value('true') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_ca_certs').with_value('/etc/ca.cert') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_certfile').with_value('/etc/certfile') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_keyfile').with_value('/etc/key') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
end
describe 'with rabbit ssl disabled' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_use_ssl => false,
:kombu_ssl_ca_certs => 'undef',
:kombu_ssl_certfile => 'undef',
:kombu_ssl_keyfile => 'undef'
}
end
it { should contain_sahara_config('DEFAULT/rabbit_use_ssl').with_value('false') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
it { should contain_sahara_config('DEFAULT/kombu_ssl_version').with_ensure('absent') }
end
describe 'when passing params for single rabbit host' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_userid => 'guest2',
:rabbit_host => 'localhost2',
:rabbit_port => '5673',
:durable_queues => true,
}
end
it { should contain_sahara_config('DEFAULT/rabbit_userid').with_value('guest2') }
it { should contain_sahara_config('DEFAULT/rabbit_host').with_value('localhost2') }
it { should contain_sahara_config('DEFAULT/rabbit_port').with_value('5673') }
xit { should contain_sahara_config('DEFAULT/rabbit_hosts').with_value('localhost2:5673') }
it { should contain_sahara_config('DEFAULT/amqp_durable_queues').with_value('true') }
end
describe 'when passing params for multiple rabbit hosts' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_userid => 'guest3',
:rabbit_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673']
}
end
it { should contain_sahara_config('DEFAULT/rabbit_userid').with_value('guest3') }
it { should contain_sahara_config('DEFAULT/rabbit_hosts').with_value(
'nonlocalhost3:5673,nonlocalhost4:5673') }
it { should contain_sahara_config('DEFAULT/rabbit_ha_queues').with_value('true') }
it { should_not contain_sahara_config('DEFAULT/rabbit_port') }
it { should_not contain_sahara_config('DEFAULT/rabbit_host') }
end
describe 'when using deprecated params' do
let :params do
{
:durable_queues => true,
:rabbit_password => 'pass'
}
end
it { should contain_sahara_config('DEFAULT/amqp_durable_queues').with_value('true') }
end
end