Fix unused test case of neutron::plugins::ml2::arista::l3

... and cover more parameters of the class.

Change-Id: Id3180bbfb261006955bcc6a0dfd5711502c48768
This commit is contained in:
Takashi Kajinami 2022-05-17 09:32:30 +09:00
parent e046811edb
commit 0e228220dd

View File

@ -46,31 +46,32 @@ describe 'neutron::plugins::ml2::arista::l3' do
end end
shared_examples 'neutron plugin ml2 arista l3_arista' do shared_examples 'neutron plugin ml2 arista l3_arista' do
before do let :p do
params.merge!(default_params) default_params.merge(params)
end end
it 'configures ml2 arista l3_arista settings' do it 'configures ml2 arista l3_arista settings' do
should contain_neutron_plugin_ml2('l3_arista/primary_l3_host').with_value(params[:primary_l3_host]) should contain_neutron_plugin_ml2('l3_arista/primary_l3_host').with_value(p[:primary_l3_host])
should contain_neutron_plugin_ml2('l3_arista/primary_l3_host_username').with_value(params[:primary_l3_host_username]) should contain_neutron_plugin_ml2('l3_arista/primary_l3_host_username').with_value(p[:primary_l3_host_username])
should contain_neutron_plugin_ml2('l3_arista/primary_l3_host_password').with_value(params[:primary_l3_host_password]).with_secret(true) should contain_neutron_plugin_ml2('l3_arista/primary_l3_host_password').with_value(p[:primary_l3_host_password]).with_secret(true)
end should contain_neutron_plugin_ml2('l3_arista/secondary_l3_host').with_value(p[:secondary_l3_host])
should contain_neutron_plugin_ml2('l3_arista/mlag_config').with_value(p[:mlag_config])
should contain_neutron_plugin_ml2('l3_arista/l3_sync_interval').with_value(p[:l3_sync_interval])
should contain_neutron_plugin_ml2('l3_arista/use_vrf').with_value(p[:use_vrf])
end end
shared_examples 'ml2 l3_arista should fail when mlag is true and secondary is service default' do context 'with mlag enabled but secondary l3 host missing' do
let :params do before :each do
{} params.merge!({
:mlag_config => true
})
end end
before do it 'should fail' do
params.merge!(default_params)
params[:mlag_config] = true
end
it 'should fail when mlag is true and secondary l3 host is service default' do
should raise_error(Puppet::Error, /Must set secondary_l3_host when mlag_config is true./) should raise_error(Puppet::Error, /Must set secondary_l3_host when mlag_config is true./)
end end
end end
end
on_supported_os({ on_supported_os({
:supported_os => OSDefaults.get_supported_os :supported_os => OSDefaults.get_supported_os