From ce4c032d1722e288c2468fd279fdb113dceb23f8 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 1 Jan 2021 17:39:20 +0900 Subject: [PATCH] Fix ignored unit test cases Change-Id: Ibb0b7bcc268752802f3413648e6828fd4999cc9b --- ...ch.rb => neutron_agents_bigswitch_spec.rb} | 2 +- ...=> neutron_plugins_ml2_ovs_driver_spec.rb} | 30 ++++++++++++------- ... neutron_plugins_ml2_sriov_driver_spec.rb} | 30 ++++++++++++------- ...utron_subnet.rb => neutron_subnet_spec.rb} | 0 4 files changed, 39 insertions(+), 23 deletions(-) rename spec/classes/{neutron_agents_bigswitch.rb => neutron_agents_bigswitch_spec.rb} (96%) rename spec/classes/{neutron_plugins_ml2_ovs_driver.rb => neutron_plugins_ml2_ovs_driver_spec.rb} (51%) rename spec/classes/{neutron_plugins_ml2_sriov_driver.rb => neutron_plugins_ml2_sriov_driver_spec.rb} (51%) rename spec/unit/type/{neutron_subnet.rb => neutron_subnet_spec.rb} (100%) diff --git a/spec/classes/neutron_agents_bigswitch.rb b/spec/classes/neutron_agents_bigswitch_spec.rb similarity index 96% rename from spec/classes/neutron_agents_bigswitch.rb rename to spec/classes/neutron_agents_bigswitch_spec.rb index 512ec8367..38f584e06 100644 --- a/spec/classes/neutron_agents_bigswitch.rb +++ b/spec/classes/neutron_agents_bigswitch_spec.rb @@ -8,7 +8,7 @@ describe 'neutron::agents::bigswitch' do shared_examples 'neutron::agents::bigswitch' do context 'neutron bigswitch base' do it 'should have' do - should contain_package('python-networking-bigswitch').with( + should contain_package('python3-networking-bigswitch').with( :ensure => 'present', :tag => ['openstack', 'neutron-package'], ) diff --git a/spec/classes/neutron_plugins_ml2_ovs_driver.rb b/spec/classes/neutron_plugins_ml2_ovs_driver_spec.rb similarity index 51% rename from spec/classes/neutron_plugins_ml2_ovs_driver.rb rename to spec/classes/neutron_plugins_ml2_ovs_driver_spec.rb index 51a1f7fd3..893cf631d 100644 --- a/spec/classes/neutron_plugins_ml2_ovs_driver.rb +++ b/spec/classes/neutron_plugins_ml2_ovs_driver_spec.rb @@ -12,23 +12,31 @@ # # Unit tests for neutron::plugins::ml2::ovs_driver class -required 'spec_helper' +require 'spec_helper' describe 'neutron::plugins::ml2::ovs_driver' do - let :default_params do - { - :vnic_type_blacklist => [] - } + shared_examples 'neutron::plugins::ml2::ovs_driver' do + context 'when vnic_type_blacklist is not empty list' do + let :params do + { :vnic_type_blacklist => ['direct'] } + end + + it 'should configure direct in vnic_type_blacklist' do + should contain_neutron_plugin_ml2('ovs_driver/vnic_type_blacklist').with_value("direct") + end + end end - context 'when vnic_type_blacklist is not empty list' do - before :each do - params.merge!(:vnic_type_blacklist => ['direct']) - 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 'should configure direct in vnic_type_blacklist' do - shoud contain_neutron_plugin_ml2('ovs_driver/vnic_type_blacklist').with_value("direct") + it_behaves_like 'neutron::plugins::ml2::ovs_driver' end end end diff --git a/spec/classes/neutron_plugins_ml2_sriov_driver.rb b/spec/classes/neutron_plugins_ml2_sriov_driver_spec.rb similarity index 51% rename from spec/classes/neutron_plugins_ml2_sriov_driver.rb rename to spec/classes/neutron_plugins_ml2_sriov_driver_spec.rb index 60a48b75d..c0cae55ba 100644 --- a/spec/classes/neutron_plugins_ml2_sriov_driver.rb +++ b/spec/classes/neutron_plugins_ml2_sriov_driver_spec.rb @@ -12,23 +12,31 @@ # # Unit tests for neutron::plugins::ml2::sriov_driver class -required 'spec_helper' +require 'spec_helper' describe 'neutron::plugins::ml2::sriov_driver' do - let :default_params do - { - :vnic_type_blacklist => [] - } + shared_examples 'neutron::plugins::ml2::sriov_driver' do + context 'when vnic_type_blacklist is not empty list' do + let :params do + { :vnic_type_blacklist => ['direct'] } + end + + it 'should configure direct in vnic_type_blacklist' do + should contain_neutron_plugin_ml2('sriov_driver/vnic_type_blacklist').with_value("direct") + end + end end - context 'when vnic_type_blacklist is not empty list' do - before :each do - params.merge!(:vnic_type_blacklist => ['direct']) - 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 'should configure direct in vnic_type_blacklist' do - shoud contain_neutron_plugin_ml2('sriov_driver/vnic_type_blacklist').with_value("direct") + it_behaves_like 'neutron::plugins::ml2::sriov_driver' end end end diff --git a/spec/unit/type/neutron_subnet.rb b/spec/unit/type/neutron_subnet_spec.rb similarity index 100% rename from spec/unit/type/neutron_subnet.rb rename to spec/unit/type/neutron_subnet_spec.rb