1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
require 'spec_helper'
describe 'oslo::messaging::rabbit' do
let (:title) { 'keystone_config' }
shared_examples 'oslo-messaging-rabbit' do
context 'with default parameters' do
it 'configure oslo_messaging_rabbit default params' do
is_expected.to contain_keystone_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/amqp_auto_delete').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_qos_prefetch_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_login_method').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_retry_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_retry_backoff').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_interval_max').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_transient_queues_ttl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_queue').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_transient_quorum_queue').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_delivery_limit').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_max_memory_length').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_max_memory_bytes').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/enable_cancel_on_failover').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/use_queue_manager').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/hostname').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/processname').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_stream_fanout').with_value('<SERVICE DEFAULT>')
end
end
context 'with overridden parameters' do
let :params do
{
:rabbit_qos_prefetch_count => 10,
:heartbeat_timeout_threshold => 60,
:heartbeat_rate => 10,
:kombu_compression => 'bz2',
:rabbit_ha_queues => true,
:rabbit_quorum_queue => true,
:rabbit_transient_quorum_queue => true,
:rabbit_quorum_delivery_limit => 3,
:rabbit_quorum_max_memory_length => 5,
:rabbit_quorum_max_memory_bytes => 1073741824,
:enable_cancel_on_failover => false,
:use_queue_manager => false,
:hostname => 'node1.example.com',
:processname => 'procname',
:rabbit_stream_fanout => false,
}
end
it 'configures rabbit' do
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_qos_prefetch_count').with_value(10)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value(60)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_rate').with_value(10)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_compression').with_value('bz2')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_queue').with_value(true)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_transient_quorum_queue').with_value(true)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_delivery_limit').with_value(3)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_max_memory_length').with_value(5)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_quorum_max_memory_bytes').with_value(1073741824)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/enable_cancel_on_failover').with_value(false)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/use_queue_manager').with_value(false)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/hostname').with_value('node1.example.com')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/processname').with_value('procname')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_stream_fanout').with_value(false)
end
end
context 'with rabbit ssl enabled with kombu' do
let :params do
{ :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', }
end
it 'configures rabbit' do
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl').with_value(true)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_ca_file').with_value('/etc/ca.cert')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_cert_file').with_value('/etc/certfile')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_key_file').with_value('/etc/key')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_version').with_value('TLSv1')
end
end
context 'with rabbit ssl enabled without kombu' do
let :params do
{ :rabbit_use_ssl => true }
end
it 'configures rabbit' do
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl').with_value(true)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_ca_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_cert_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_key_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_version').with_value('<SERVICE DEFAULT>')
end
end
context 'with incorrect kombu compression' do
let :params do
{ :kombu_compression => 'foo' }
end
it { is_expected.to raise_error Puppet::Error, /Unsupported Kombu compression. Possible values are gzip and bz2/ }
end
context 'with kombu_ssl_ca_certs enabled without ssl usage' do
let :params do
{ :kombu_ssl_ca_certs => '/etc/ca.cert' }
end
it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true/ }
end
context 'with kombu_ssl_certfile set without rabbit ssl usage' do
let :params do
{ :kombu_ssl_certfile => '/tmp/foo' }
end
it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true/ }
end
context 'with kombu_ssl_version set without rabbit ssl usage' do
let :params do
{ :kombu_ssl_version => 'foo' }
end
it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_version parameter requires rabbit_use_ssl to be set to true/ }
end
context 'with kombu_ssl_certfile set without kombu_ssl_keyfile' do
let :params do
{ :rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/etc/ca.cert',
:kombu_ssl_certfile => '/etc/certfile',
:kombu_ssl_version => 'TLSv1', }
end
it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_certfile parameter and the kombu_ssl_keyfile parameters must be used together/ }
end
context 'with kombu_ssl_keyfile set without kombu_ssl_certfile' do
let :params do
{ :rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/etc/ca.cert',
:kombu_ssl_keyfile => '/etc/key',
:kombu_ssl_version => 'TLSv1', }
end
it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_certfile parameter and the kombu_ssl_keyfile parameters must be used together/ }
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 'oslo-messaging-rabbit'
end
end
end
|