Fix ignored unit test cases

The unit test cases for notification parameters have been ignored. Fix
the problem and also refactor test definitions for easier maintenance.

Change-Id: Ib53377f0316f25781017cc5c394162a77bc17f49
(cherry picked from commit f5aea42039)
This commit is contained in:
Takashi Kajinami 2024-09-30 12:11:11 +09:00
parent e643c3cd04
commit 154a10b695

View File

@ -13,25 +13,9 @@ describe 'neutron' do
shared_examples 'neutron' do
it_behaves_like 'a neutron base installation'
context 'with rabbitmq heartbeat configured' do
before { params.merge!(
:rabbit_heartbeat_timeout_threshold => '60',
:rabbit_heartbeat_rate => '10',
:rabbit_heartbeat_in_pthread => true,
) }
it_behaves_like 'rabbit with heartbeat configured'
end
context 'with rabbitmq durable queues configured' do
before { params.merge!( :amqp_durable_queues => true ) }
it_behaves_like 'rabbit with durable queues'
end
context 'with rabbitmq non default transient_queues_ttl' do
before { params.merge!( :rabbit_transient_queues_ttl => 20 ) }
it_behaves_like 'rabbit with non default transient_queues_ttl'
end
it_behaves_like 'with rabbit parameters configured'
it_behaves_like 'with notification parameters configured'
it_behaves_like 'with SSL enabled without kombu'
it_behaves_like 'with SSL enabled with kombu'
it_behaves_like 'with SSL enabled without kombu'
it_behaves_like 'with SSL disabled'
@ -133,41 +117,39 @@ describe 'neutron' do
end
end
shared_examples 'rabbit with heartbeat configured' do
shared_examples 'with rabbit parameters configured' do
before do
params.merge!(
:rabbit_heartbeat_timeout_threshold => 60,
:rabbit_heartbeat_rate => 10,
:rabbit_heartbeat_in_pthread => true,
:amqp_durable_queues => true,
:rabbit_ha_queues => true,
:rabbit_transient_queues_ttl => 20,
)
end
it 'in neutron.conf' do
should contain_oslo__messaging__rabbit('neutron_config').with(
:heartbeat_timeout_threshold => '60',
:heartbeat_rate => '10',
:heartbeat_timeout_threshold => 60,
:heartbeat_rate => 10,
:heartbeat_in_pthread => true,
:amqp_durable_queues => true,
:rabbit_ha_queues => true,
:rabbit_transient_queues_ttl => 20,
)
end
end
shared_examples 'rabbit with durable queues' do
it 'in neutron.conf' do
should contain_oslo__messaging__rabbit('neutron_config').with(
:amqp_durable_queues => true
shared_examples 'with notification parameters configured' do
before do
params.merge!(
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:notification_driver => 'mesagingv2',
:notification_topics => 'notifications',
)
end
end
shared_examples 'rabbit with non default transient_queues_ttl' do
it 'in neutron.conf' do
should contain_oslo__messaging__rabbit('neutron_config').with(
:rabbit_transient_queues_ttl => 20
)
end
end
shared_examples 'rabbit_ha_queues set to false' do
it 'in neutron.conf' do
should contain_oslo__messaging__rabbit('neutron_config').with(
:rabbit_ha_queues => true
)
end
end
shared_examples 'notification_driver and notification_topics' do
it 'in neutron.conf' do
should contain_oslo__messaging__notifications('neutron_config').with(
:transport_url => params[:notification_transport_url],