Avoid testing details of oslo::messaging(::*)
... so that any change in puppet-oslo would not directly break unit tests. Change-Id: Ib6b2dbe5301604dac0f6790843931c6e367dcbec
This commit is contained in:
parent
0961b98387
commit
ed6e54bf51
@ -41,7 +41,6 @@ describe 'heat' do
|
||||
it_configures 'with SSL enabled with kombu'
|
||||
it_configures 'with SSL enabled without kombu'
|
||||
it_configures 'with SSL disabled'
|
||||
it_configures 'with SSL wrongly configured'
|
||||
it_configures 'with enable_stack_adopt and enable_stack_abandon set'
|
||||
it_configures 'with overridden transport_url parameter'
|
||||
it_configures 'with notification_driver set to a string'
|
||||
@ -130,9 +129,11 @@ describe 'heat' do
|
||||
it { is_expected.to contain_heat_config('paste_deploy/flavor').with_value('keystone') }
|
||||
|
||||
it 'configures notification_driver' do
|
||||
is_expected.to contain_heat_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_notifications/topics').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo__messaging__notifications('heat_config').with(
|
||||
:driver => '<SERVICE DEFAULT>',
|
||||
:transport_url => '<SERVICE DEFAULT>',
|
||||
:topics => '<SERVICE DEFAULT>'
|
||||
)
|
||||
end
|
||||
|
||||
it 'sets default value for http_proxy_to_wsgi middleware' do
|
||||
@ -150,23 +151,22 @@ describe 'heat' do
|
||||
|
||||
shared_examples_for 'configures default rabbitmq parameters' do
|
||||
it 'configures rabbit' do
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo__messaging__rabbit('heat_config').with(
|
||||
:rabbit_use_ssl => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_version => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_version => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
|
||||
:kombu_reconnect_delay => '<SERVICE DEFAULT>',
|
||||
:kombu_failover_strategy => '<SERVICE DEFAULT>',
|
||||
:kombu_compression => '<SERVICE DEFAULT>',
|
||||
:heartbeat_timeout_threshold => '<SERVICE DEFAULT>',
|
||||
:heartbeat_rate => '<SERVICE DEFAULT>',
|
||||
:heartbeat_in_pthread => '<SERVICE DEFAULT>',
|
||||
:rabbit_use_ssl => '<SERVICE DEFAULT>',
|
||||
:amqp_durable_queues => '<SERVICE DEFAULT>',
|
||||
:rabbit_ha_queues => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
shared_examples_for 'configures rabbit with HA and durable' do
|
||||
@ -175,26 +175,43 @@ describe 'heat' do
|
||||
:amqp_durable_queues => true )
|
||||
end
|
||||
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true) }
|
||||
it 'configures rabbit' do
|
||||
is_expected.to contain_oslo__messaging__rabbit('heat_config').with(
|
||||
:kombu_ssl_version => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
|
||||
:kombu_reconnect_delay => '<SERVICE DEFAULT>',
|
||||
:kombu_failover_strategy => '<SERVICE DEFAULT>',
|
||||
:kombu_compression => '<SERVICE DEFAULT>',
|
||||
:heartbeat_timeout_threshold => '<SERVICE DEFAULT>',
|
||||
:heartbeat_rate => '<SERVICE DEFAULT>',
|
||||
:heartbeat_in_pthread => '<SERVICE DEFAULT>',
|
||||
:rabbit_use_ssl => '<SERVICE DEFAULT>',
|
||||
:amqp_durable_queues => true,
|
||||
:rabbit_ha_queues => true,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'rabbit with heartbeat configured' do
|
||||
it 'configures rabbit' do
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_heat_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo__messaging__rabbit('heat_config').with(
|
||||
:rabbit_use_ssl => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_version => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_version => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
|
||||
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
|
||||
:kombu_reconnect_delay => '<SERVICE DEFAULT>',
|
||||
:kombu_failover_strategy => '<SERVICE DEFAULT>',
|
||||
:kombu_compression => '<SERVICE DEFAULT>',
|
||||
:heartbeat_timeout_threshold => '60',
|
||||
:heartbeat_rate => '10',
|
||||
:heartbeat_in_pthread => true,
|
||||
:rabbit_use_ssl => '<SERVICE DEFAULT>',
|
||||
:amqp_durable_queues => '<SERVICE DEFAULT>',
|
||||
:rabbit_ha_queues => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value(true) }
|
||||
end
|
||||
|
||||
shared_examples_for 'with SSL enabled with kombu' do
|
||||
@ -209,11 +226,11 @@ describe 'heat' do
|
||||
end
|
||||
|
||||
it { is_expected.to contain_oslo__messaging__rabbit('heat_config').with(
|
||||
:rabbit_use_ssl => true,
|
||||
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
|
||||
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
|
||||
:kombu_ssl_version => 'TLSv1',
|
||||
:kombu_ssl_keyfile => '/path/to/ssl/keyfile',
|
||||
:kombu_ssl_version => 'TLSv1'
|
||||
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
|
||||
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
|
||||
:rabbit_use_ssl => true,
|
||||
)}
|
||||
end
|
||||
|
||||
@ -241,33 +258,6 @@ describe 'heat' do
|
||||
)}
|
||||
end
|
||||
|
||||
shared_examples_for 'with SSL wrongly configured' do
|
||||
before do
|
||||
params.merge!(
|
||||
:rabbit_use_ssl => false
|
||||
)
|
||||
end
|
||||
|
||||
context 'without required parameters' do
|
||||
|
||||
context 'with rabbit_use_ssl => false and kombu_ssl_ca_certs parameter' do
|
||||
before { params.merge!(:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs')}
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true/
|
||||
end
|
||||
|
||||
context 'with rabbit_use_ssl => false and kombu_ssl_certfile parameter' do
|
||||
before { params.merge!(:kombu_ssl_certfile => '/path/to/ssl/cert/file')}
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true/
|
||||
end
|
||||
|
||||
context 'with rabbit_use_ssl => false and kombu_ssl_keyfile parameter' do
|
||||
before { params.merge!(:kombu_ssl_keyfile => '/path/to/ssl/keyfile')}
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true/
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
shared_examples_for 'with heat_clients_endpoint_type set' do
|
||||
before do
|
||||
params.merge!(
|
||||
@ -344,9 +334,11 @@ describe 'heat' do
|
||||
end
|
||||
|
||||
it 'configures transport_url' do
|
||||
is_expected.to contain_heat_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
|
||||
is_expected.to contain_heat_config('DEFAULT/rpc_response_timeout').with_value('120')
|
||||
is_expected.to contain_heat_config('DEFAULT/control_exchange').with_value('heat')
|
||||
is_expected.to contain_oslo__messaging__default('heat_config').with(
|
||||
:transport_url => 'rabbit://rabbit_user:password@localhost:5673',
|
||||
:rpc_response_timeout => '120',
|
||||
:control_exchange => 'heat'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@ -354,35 +346,39 @@ describe 'heat' do
|
||||
before do
|
||||
params.merge!(
|
||||
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
|
||||
:notification_driver => 'bar.foo.rpc_notifier',
|
||||
:notification_topics => 'messagingv2',
|
||||
:notification_driver => 'messagingv2',
|
||||
:notification_topics => 'notifications',
|
||||
)
|
||||
end
|
||||
|
||||
it 'has notification_driver set when specified' do
|
||||
is_expected.to contain_heat_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
|
||||
is_expected.to contain_heat_config('oslo_messaging_notifications/driver').with_value('bar.foo.rpc_notifier')
|
||||
is_expected.to contain_heat_config('oslo_messaging_notifications/topics').with_value('messagingv2')
|
||||
is_expected.to contain_oslo__messaging__notifications('heat_config').with(
|
||||
:driver => 'messagingv2',
|
||||
:transport_url => 'rabbit://rabbit_user:password@localhost:5673',
|
||||
:topics => 'notifications'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'amqp support' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/server_request_prefix').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/broadcast_prefix').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/group_request_prefix').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/container_name').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/trace').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/ssl_ca_file').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/ssl_cert_file').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/ssl_key_file').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/ssl_key_password').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/username').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/password').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo__messaging__amqp('heat_config').with(
|
||||
:server_request_prefix => '<SERVICE DEFAULT>',
|
||||
:broadcast_prefix => '<SERVICE DEFAULT>',
|
||||
:group_request_prefix => '<SERVICE DEFAULT>',
|
||||
:container_name => '<SERVICE DEFAULT>',
|
||||
:idle_timeout => '<SERVICE DEFAULT>',
|
||||
:trace => '<SERVICE DEFAULT>',
|
||||
:ssl_ca_file => '<SERVICE DEFAULT>',
|
||||
:ssl_cert_file => '<SERVICE DEFAULT>',
|
||||
:ssl_key_file => '<SERVICE DEFAULT>',
|
||||
:ssl_key_password => '<SERVICE DEFAULT>',
|
||||
:sasl_mechanisms => '<SERVICE DEFAULT>',
|
||||
:sasl_config_dir => '<SERVICE DEFAULT>',
|
||||
:sasl_config_name => '<SERVICE DEFAULT>',
|
||||
:username => '<SERVICE DEFAULT>',
|
||||
:password => '<SERVICE DEFAULT>',
|
||||
) }
|
||||
end
|
||||
|
||||
context 'with overridden amqp parameters' do
|
||||
@ -396,20 +392,23 @@ describe 'heat' do
|
||||
:amqp_password => 'password',
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/server_request_prefix').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/broadcast_prefix').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/group_request_prefix').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/container_name').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/idle_timeout').with_value('60') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/trace').with_value('true') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/ssl_ca_file').with_value('/path/to/ca.cert') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/ssl_cert_file').with_value('/path/to/certfile') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/ssl_key_file').with_value('/path/to/key') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/username').with_value('amqp_user') }
|
||||
it { is_expected.to contain_heat_config('oslo_messaging_amqp/password').with_value('password') }
|
||||
it { is_expected.to contain_oslo__messaging__amqp('heat_config').with(
|
||||
:server_request_prefix => '<SERVICE DEFAULT>',
|
||||
:broadcast_prefix => '<SERVICE DEFAULT>',
|
||||
:group_request_prefix => '<SERVICE DEFAULT>',
|
||||
:container_name => '<SERVICE DEFAULT>',
|
||||
:idle_timeout => '60',
|
||||
:trace => true,
|
||||
:ssl_ca_file => '/path/to/ca.cert',
|
||||
:ssl_cert_file => '/path/to/certfile',
|
||||
:ssl_key_file => '/path/to/key',
|
||||
:ssl_key_password => '<SERVICE DEFAULT>',
|
||||
:sasl_mechanisms => '<SERVICE DEFAULT>',
|
||||
:sasl_config_dir => '<SERVICE DEFAULT>',
|
||||
:sasl_config_name => '<SERVICE DEFAULT>',
|
||||
:username => 'amqp_user',
|
||||
:password => 'password',
|
||||
) }
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user