tests: Handle missing extensions in network tests
This is mostly a case of skipping tests where the extension is missing, but some tests are updated to remove a reliance on optional tests. Change-Id: I25b8811fe09f2a4a9fc20ca5459f5a404b88a337 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
c251cb89a5
commit
1678f87d7a
@ -47,6 +47,12 @@ class TestMeterRule(common.NetworkTests):
|
||||
finally:
|
||||
super().tearDownClass()
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.is_extension_enabled("metering"):
|
||||
self.skipTest("No metering extension present")
|
||||
|
||||
def test_meter_rule_delete(self):
|
||||
"""test create, delete"""
|
||||
json_output = self.openstack(
|
||||
|
@ -18,7 +18,15 @@ import uuid
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
class NetworkQosTests(common.NetworkTests):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.is_extension_enabled("qos"):
|
||||
self.skipTest("No qos extension present")
|
||||
|
||||
|
||||
class NetworkQosRuleTestsMinimumBandwidth(NetworkQosTests):
|
||||
"""Functional tests for QoS minimum bandwidth rule"""
|
||||
|
||||
def setUp(self):
|
||||
@ -93,7 +101,7 @@ class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
self.assertEqual(7500, cmd_output['min_kbps'])
|
||||
|
||||
|
||||
class NetworkQosRuleTestsMinimumPacketRate(common.NetworkTests):
|
||||
class NetworkQosRuleTestsMinimumPacketRate(NetworkQosTests):
|
||||
"""Functional tests for QoS minimum packet rate rule"""
|
||||
|
||||
def setUp(self):
|
||||
@ -169,7 +177,7 @@ class NetworkQosRuleTestsMinimumPacketRate(common.NetworkTests):
|
||||
self.assertEqual('any', cmd_output['direction'])
|
||||
|
||||
|
||||
class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
|
||||
class NetworkQosRuleTestsDSCPMarking(NetworkQosTests):
|
||||
"""Functional tests for QoS DSCP marking rule"""
|
||||
|
||||
def setUp(self):
|
||||
@ -241,7 +249,7 @@ class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
|
||||
self.assertEqual(32, cmd_output['dscp_mark'])
|
||||
|
||||
|
||||
class NetworkQosRuleTestsBandwidthLimit(common.NetworkTests):
|
||||
class NetworkQosRuleTestsBandwidthLimit(NetworkQosTests):
|
||||
"""Functional tests for QoS bandwidth limit rule"""
|
||||
|
||||
def setUp(self):
|
||||
|
@ -44,6 +44,12 @@ class NetworkSegmentTests(common.NetworkTests):
|
||||
finally:
|
||||
super().tearDownClass()
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.is_extension_enabled("segment"):
|
||||
self.skipTest("No segment extension present")
|
||||
|
||||
def test_network_segment_create_delete(self):
|
||||
name = uuid.uuid4().hex
|
||||
json_output = self.openstack(
|
||||
@ -110,12 +116,7 @@ class NetworkSegmentTests(common.NetworkTests):
|
||||
)
|
||||
self.addCleanup(self.openstack, 'network segment delete ' + name)
|
||||
|
||||
extension_output = self.openstack(
|
||||
"extension list ",
|
||||
parse_output=True,
|
||||
)
|
||||
ext_alias = [x["Alias"] for x in extension_output]
|
||||
if "standard-attr-segment" in ext_alias:
|
||||
if self.is_extension_enabled('standard-attr-segment'):
|
||||
self.assertEqual(
|
||||
'',
|
||||
json_output["description"],
|
||||
|
@ -24,6 +24,9 @@ class NetworkTrunkTests(common.NetworkTests):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.is_extension_enabled("trunk"):
|
||||
self.skipTest("No trunk extension present")
|
||||
|
||||
network_name = uuid.uuid4().hex
|
||||
subnet_name = uuid.uuid4().hex
|
||||
self.parent_port_name = uuid.uuid4().hex
|
||||
|
@ -211,7 +211,6 @@ class SubnetTests(common.NetworkTagTests):
|
||||
+ ' --description bbbb '
|
||||
+ '--no-dhcp '
|
||||
+ '--gateway 10.10.11.1 '
|
||||
+ '--service-type network:floatingip_agent_gateway '
|
||||
+ name
|
||||
)
|
||||
self.assertOutput('', cmd_output)
|
||||
@ -236,27 +235,16 @@ class SubnetTests(common.NetworkTagTests):
|
||||
'10.10.11.1',
|
||||
cmd_output["gateway_ip"],
|
||||
)
|
||||
self.assertEqual(
|
||||
['network:floatingip_agent_gateway'],
|
||||
cmd_output["service_types"],
|
||||
)
|
||||
|
||||
# Test unset
|
||||
cmd_output = self.openstack(
|
||||
'subnet unset '
|
||||
+ '--service-type network:floatingip_agent_gateway '
|
||||
+ new_name
|
||||
)
|
||||
cmd_output = self.openstack('subnet unset --gateway ' + new_name)
|
||||
self.assertOutput('', cmd_output)
|
||||
|
||||
cmd_output = self.openstack(
|
||||
'subnet show ' + new_name,
|
||||
parse_output=True,
|
||||
)
|
||||
self.assertEqual(
|
||||
[],
|
||||
cmd_output["service_types"],
|
||||
)
|
||||
self.assertIsNone(cmd_output["gateway_ip"])
|
||||
|
||||
def _subnet_create(self, cmd, name, is_type_ipv4=True):
|
||||
# Try random subnet range for subnet creating
|
||||
|
Loading…
Reference in New Issue
Block a user