Fix dynamic names in network functional tests
Move all of the dynamic resource naming in Network functional tests into setUpClass() methods (if they exist) rather than assigning those names at load-time. Change-Id: Ic550ff7d40c2b3ca5128cacccbe331790d6ae340
This commit is contained in:
parent
99a502b203
commit
8d7ee8da0e
@ -19,17 +19,18 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
class FloatingIpTests(common.NetworkTests):
|
||||
"""Functional tests for floating ip"""
|
||||
EXTERNAL_NETWORK_NAME = uuid.uuid4().hex
|
||||
EXTERNAL_SUBNET_NAME = uuid.uuid4().hex
|
||||
PRIVATE_NETWORK_NAME = uuid.uuid4().hex
|
||||
PRIVATE_SUBNET_NAME = uuid.uuid4().hex
|
||||
ROUTER = uuid.uuid4().hex
|
||||
PORT_NAME = uuid.uuid4().hex
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
cls.EXTERNAL_NETWORK_NAME = uuid.uuid4().hex
|
||||
cls.EXTERNAL_SUBNET_NAME = uuid.uuid4().hex
|
||||
cls.PRIVATE_NETWORK_NAME = uuid.uuid4().hex
|
||||
cls.PRIVATE_SUBNET_NAME = uuid.uuid4().hex
|
||||
cls.ROUTER = uuid.uuid4().hex
|
||||
cls.PORT_NAME = uuid.uuid4().hex
|
||||
|
||||
# Create a network for the floating ip
|
||||
json_output = json.loads(cls.openstack(
|
||||
'network create -f json ' +
|
||||
|
@ -23,9 +23,10 @@ class IPAvailabilityTests(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create a network for the subnet.
|
||||
cls.NAME = uuid.uuid4().hex
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
|
||||
# Create a network for the subnet
|
||||
cls.openstack(
|
||||
'network create ' +
|
||||
cls.NETWORK_NAME
|
||||
|
@ -22,7 +22,6 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
class TestMeterRule(common.NetworkTests):
|
||||
"""Functional tests for meter rule"""
|
||||
|
||||
METER_NAME = uuid.uuid4().hex
|
||||
METER_ID = None
|
||||
METER_RULE_ID = None
|
||||
|
||||
@ -30,6 +29,8 @@ class TestMeterRule(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
cls.METER_NAME = uuid.uuid4().hex
|
||||
|
||||
json_output = json.loads(cls.openstack(
|
||||
'network meter create -f json ' +
|
||||
cls.METER_NAME
|
||||
|
@ -19,8 +19,7 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkQosPolicyTests(common.NetworkTests):
|
||||
"""Functional tests for QoS policy. """
|
||||
NAME = uuid.uuid4().hex
|
||||
"""Functional tests for QoS policy"""
|
||||
HEADERS = ['Name']
|
||||
FIELDS = ['name']
|
||||
|
||||
@ -28,6 +27,8 @@ class NetworkQosPolicyTests(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
cls.NAME = uuid.uuid4().hex
|
||||
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack(
|
||||
'network qos policy create ' +
|
||||
|
@ -21,7 +21,6 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
"""Functional tests for QoS minimum bandwidth rule"""
|
||||
RULE_ID = None
|
||||
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
MIN_KBPS = 2800
|
||||
MIN_KBPS_MODIFIED = 7500
|
||||
DIRECTION = '--egress'
|
||||
@ -33,6 +32,8 @@ class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
cls.QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
cls.openstack(
|
||||
'network qos policy create ' +
|
||||
|
@ -16,9 +16,7 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkRBACTests(common.NetworkTests):
|
||||
"""Functional tests for network rbac. """
|
||||
NET_NAME = uuid.uuid4().hex
|
||||
PROJECT_NAME = uuid.uuid4().hex
|
||||
"""Functional tests for network rbac"""
|
||||
OBJECT_ID = None
|
||||
ID = None
|
||||
HEADERS = ['ID']
|
||||
@ -28,6 +26,9 @@ class NetworkRBACTests(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
cls.NET_NAME = uuid.uuid4().hex
|
||||
cls.PROJECT_NAME = uuid.uuid4().hex
|
||||
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack(
|
||||
'network create ' + cls.NET_NAME + opts
|
||||
|
@ -17,8 +17,6 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
class NetworkSegmentTests(common.NetworkTests):
|
||||
"""Functional tests for network segment"""
|
||||
NETWORK_NAME = uuid.uuid4().hex
|
||||
PHYSICAL_NETWORK_NAME = uuid.uuid4().hex
|
||||
NETWORK_SEGMENT_ID = None
|
||||
NETWORK_ID = None
|
||||
NETWORK_SEGMENT_EXTENSION = None
|
||||
@ -27,7 +25,10 @@ class NetworkSegmentTests(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create a network for the segment.
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
cls.PHYSICAL_NETWORK_NAME = uuid.uuid4().hex
|
||||
|
||||
# Create a network for the segment
|
||||
opts = cls.get_opts(['id'])
|
||||
raw_output = cls.openstack(
|
||||
'network create ' + cls.NETWORK_NAME + opts
|
||||
|
@ -18,14 +18,15 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
class PortTests(common.NetworkTests):
|
||||
"""Functional tests for port"""
|
||||
NAME = uuid.uuid4().hex
|
||||
NETWORK_NAME = uuid.uuid4().hex
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create a network for the port
|
||||
cls.NAME = uuid.uuid4().hex
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
|
||||
# Create a network for the port tests
|
||||
cls.openstack(
|
||||
'network create ' + cls.NETWORK_NAME
|
||||
)
|
||||
|
@ -17,8 +17,6 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
class SecurityGroupTests(common.NetworkTests):
|
||||
"""Functional tests for security group"""
|
||||
NAME = uuid.uuid4().hex
|
||||
OTHER_NAME = uuid.uuid4().hex
|
||||
HEADERS = ['Name']
|
||||
FIELDS = ['name']
|
||||
|
||||
@ -26,6 +24,9 @@ class SecurityGroupTests(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
cls.NAME = uuid.uuid4().hex
|
||||
cls.OTHER_NAME = uuid.uuid4().hex
|
||||
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack(
|
||||
'security group create ' +
|
||||
|
@ -17,7 +17,6 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
class SecurityGroupRuleTests(common.NetworkTests):
|
||||
"""Functional tests for security group rule"""
|
||||
SECURITY_GROUP_NAME = uuid.uuid4().hex
|
||||
SECURITY_GROUP_RULE_ID = None
|
||||
NAME_FIELD = ['name']
|
||||
ID_FIELD = ['id']
|
||||
@ -27,7 +26,9 @@ class SecurityGroupRuleTests(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create the security group to hold the rule.
|
||||
cls.SECURITY_GROUP_NAME = uuid.uuid4().hex
|
||||
|
||||
# Create the security group to hold the rule
|
||||
opts = cls.get_opts(cls.NAME_FIELD)
|
||||
raw_output = cls.openstack(
|
||||
'security group create ' +
|
||||
|
@ -24,8 +24,9 @@ class SubnetTests(common.NetworkTests):
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create a network for the all subnet tests
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
|
||||
# Create a network for the all subnet tests
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
'network create -f json ' +
|
||||
cls.NETWORK_NAME
|
||||
|
Loading…
x
Reference in New Issue
Block a user