From e64cd956f4abbaba1f601763f0985e4c28f604b2 Mon Sep 17 00:00:00 2001 From: Aleksandr Didenko Date: Fri, 29 Jan 2016 18:02:33 +0100 Subject: [PATCH] Fix outdated noop rspec tests Fix some outdated rspec tests to make them work properly with more recent fixture. Disabled integration tests since this patch affects noops only. Change-Id: I6c369cdc0262d7a681deda2a5a9ac58bdcea7136 Fuel-CI: disable Partial-bug: #1535339 --- .../hosts/openstack-network/networks_spec.rb | 23 ++++++++++++++++--- .../hosts/virtual_ips/virtual_ips_spec.rb | 7 +++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/tests/noop/spec/hosts/openstack-network/networks_spec.rb b/tests/noop/spec/hosts/openstack-network/networks_spec.rb index 476aa90ebd..cb17f34d66 100644 --- a/tests/noop/spec/hosts/openstack-network/networks_spec.rb +++ b/tests/noop/spec/hosts/openstack-network/networks_spec.rb @@ -14,6 +14,14 @@ describe manifest do default_router = (neutron_config['default_router'] or 'router04') context 'Private network', :if => nets.has_key?(private_net) do + case neutron_config['L2']['segmentation_type'] + when 'vlan' + network_type = 'vlan' + when 'gre' + network_type = 'gre' + else + network_type = 'vxlan' + end if nets[private_net]['L2']['segment_id'] segment_id = nets[private_net]['L2']['segment_id'] else @@ -27,7 +35,7 @@ describe manifest do should contain_neutron_network(private_net).with( 'ensure' => 'present', 'provider_physical_network' => (nets[private_net]['L2']['physnet'] or false), - 'provider_network_type' => nets[private_net]['L2']['network_type'], + 'provider_network_type' => network_type, 'provider_segmentation_id' => segment_id, 'router_external' => nets[private_net]['L2']['router_ext'], 'shared' => nets[private_net]['shared'], @@ -56,8 +64,17 @@ describe manifest do ) end floating_range = nets[floating_net]['L3']['floating'] - if floating_range - floating_range = floating_range.split(':') + if floating_range and !floating_range.empty? + if floating_range.is_a?(Array) + # floating_range is array but we don't support more than one range + # so we just take first element + floating_range = floating_range[0].split(':') + else + # TODO: (adidenko) remove this condition when we update all fixtures + # in old astute.yaml fixtures floating_range is a string + # but in 8.0+ it's always array + floating_range = floating_range.split(':') + end end it 'should create subnet for floating' do should contain_neutron_subnet("#{floating_net}__subnet").with( diff --git a/tests/noop/spec/hosts/virtual_ips/virtual_ips_spec.rb b/tests/noop/spec/hosts/virtual_ips/virtual_ips_spec.rb index 54097088fb..420418007c 100644 --- a/tests/noop/spec/hosts/virtual_ips/virtual_ips_spec.rb +++ b/tests/noop/spec/hosts/virtual_ips/virtual_ips_spec.rb @@ -9,9 +9,10 @@ describe manifest do Noop.hiera_structure('network_metadata/vips', {}).each do |name, params| next unless params['network_role'] next unless params['node_roles'] - - it "should have '#{name}' VIP" do - expect(subject).to contain_cluster__virtual_ip(name) + if params['namespace'] + it "should have '#{name}' VIP" do + expect(subject).to contain_cluster__virtual_ip(name) + end end end end