Skip to content

Commit 8d7ee8d

Browse files
author
Dean Troyer
committed
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
1 parent 99a502b commit 8d7ee8d

11 files changed

Lines changed: 36 additions & 25 deletions

openstackclient/tests/functional/network/v2/test_floating_ip.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@
1919

2020
class FloatingIpTests(common.NetworkTests):
2121
"""Functional tests for floating ip"""
22-
EXTERNAL_NETWORK_NAME = uuid.uuid4().hex
23-
EXTERNAL_SUBNET_NAME = uuid.uuid4().hex
24-
PRIVATE_NETWORK_NAME = uuid.uuid4().hex
25-
PRIVATE_SUBNET_NAME = uuid.uuid4().hex
26-
ROUTER = uuid.uuid4().hex
27-
PORT_NAME = uuid.uuid4().hex
2822

2923
@classmethod
3024
def setUpClass(cls):
3125
common.NetworkTests.setUpClass()
3226
if cls.haz_network:
27+
cls.EXTERNAL_NETWORK_NAME = uuid.uuid4().hex
28+
cls.EXTERNAL_SUBNET_NAME = uuid.uuid4().hex
29+
cls.PRIVATE_NETWORK_NAME = uuid.uuid4().hex
30+
cls.PRIVATE_SUBNET_NAME = uuid.uuid4().hex
31+
cls.ROUTER = uuid.uuid4().hex
32+
cls.PORT_NAME = uuid.uuid4().hex
33+
3334
# Create a network for the floating ip
3435
json_output = json.loads(cls.openstack(
3536
'network create -f json ' +

openstackclient/tests/functional/network/v2/test_ip_availability.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ class IPAvailabilityTests(common.NetworkTests):
2323
def setUpClass(cls):
2424
common.NetworkTests.setUpClass()
2525
if cls.haz_network:
26-
# Create a network for the subnet.
2726
cls.NAME = uuid.uuid4().hex
2827
cls.NETWORK_NAME = uuid.uuid4().hex
28+
29+
# Create a network for the subnet
2930
cls.openstack(
3031
'network create ' +
3132
cls.NETWORK_NAME

openstackclient/tests/functional/network/v2/test_network_meter_rule.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
class TestMeterRule(common.NetworkTests):
2323
"""Functional tests for meter rule"""
2424

25-
METER_NAME = uuid.uuid4().hex
2625
METER_ID = None
2726
METER_RULE_ID = None
2827

2928
@classmethod
3029
def setUpClass(cls):
3130
common.NetworkTests.setUpClass()
3231
if cls.haz_network:
32+
cls.METER_NAME = uuid.uuid4().hex
33+
3334
json_output = json.loads(cls.openstack(
3435
'network meter create -f json ' +
3536
cls.METER_NAME

openstackclient/tests/functional/network/v2/test_network_qos_policy.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919

2020

2121
class NetworkQosPolicyTests(common.NetworkTests):
22-
"""Functional tests for QoS policy. """
23-
NAME = uuid.uuid4().hex
22+
"""Functional tests for QoS policy"""
2423
HEADERS = ['Name']
2524
FIELDS = ['name']
2625

2726
@classmethod
2827
def setUpClass(cls):
2928
common.NetworkTests.setUpClass()
3029
if cls.haz_network:
30+
cls.NAME = uuid.uuid4().hex
31+
3132
opts = cls.get_opts(cls.FIELDS)
3233
raw_output = cls.openstack(
3334
'network qos policy create ' +

openstackclient/tests/functional/network/v2/test_network_qos_rule.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
2222
"""Functional tests for QoS minimum bandwidth rule"""
2323
RULE_ID = None
24-
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
2524
MIN_KBPS = 2800
2625
MIN_KBPS_MODIFIED = 7500
2726
DIRECTION = '--egress'
@@ -33,6 +32,8 @@ class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
3332
def setUpClass(cls):
3433
common.NetworkTests.setUpClass()
3534
if cls.haz_network:
35+
cls.QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
36+
3637
opts = cls.get_opts(cls.FIELDS)
3738
cls.openstack(
3839
'network qos policy create ' +

openstackclient/tests/functional/network/v2/test_network_rbac.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717

1818
class NetworkRBACTests(common.NetworkTests):
19-
"""Functional tests for network rbac. """
20-
NET_NAME = uuid.uuid4().hex
21-
PROJECT_NAME = uuid.uuid4().hex
19+
"""Functional tests for network rbac"""
2220
OBJECT_ID = None
2321
ID = None
2422
HEADERS = ['ID']
@@ -28,6 +26,9 @@ class NetworkRBACTests(common.NetworkTests):
2826
def setUpClass(cls):
2927
common.NetworkTests.setUpClass()
3028
if cls.haz_network:
29+
cls.NET_NAME = uuid.uuid4().hex
30+
cls.PROJECT_NAME = uuid.uuid4().hex
31+
3132
opts = cls.get_opts(cls.FIELDS)
3233
raw_output = cls.openstack(
3334
'network create ' + cls.NET_NAME + opts

openstackclient/tests/functional/network/v2/test_network_segment.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
class NetworkSegmentTests(common.NetworkTests):
1919
"""Functional tests for network segment"""
20-
NETWORK_NAME = uuid.uuid4().hex
21-
PHYSICAL_NETWORK_NAME = uuid.uuid4().hex
2220
NETWORK_SEGMENT_ID = None
2321
NETWORK_ID = None
2422
NETWORK_SEGMENT_EXTENSION = None
@@ -27,7 +25,10 @@ class NetworkSegmentTests(common.NetworkTests):
2725
def setUpClass(cls):
2826
common.NetworkTests.setUpClass()
2927
if cls.haz_network:
30-
# Create a network for the segment.
28+
cls.NETWORK_NAME = uuid.uuid4().hex
29+
cls.PHYSICAL_NETWORK_NAME = uuid.uuid4().hex
30+
31+
# Create a network for the segment
3132
opts = cls.get_opts(['id'])
3233
raw_output = cls.openstack(
3334
'network create ' + cls.NETWORK_NAME + opts

openstackclient/tests/functional/network/v2/test_port.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818

1919
class PortTests(common.NetworkTests):
2020
"""Functional tests for port"""
21-
NAME = uuid.uuid4().hex
22-
NETWORK_NAME = uuid.uuid4().hex
2321

2422
@classmethod
2523
def setUpClass(cls):
2624
common.NetworkTests.setUpClass()
2725
if cls.haz_network:
28-
# Create a network for the port
26+
cls.NAME = uuid.uuid4().hex
27+
cls.NETWORK_NAME = uuid.uuid4().hex
28+
29+
# Create a network for the port tests
2930
cls.openstack(
3031
'network create ' + cls.NETWORK_NAME
3132
)

openstackclient/tests/functional/network/v2/test_security_group.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717

1818
class SecurityGroupTests(common.NetworkTests):
1919
"""Functional tests for security group"""
20-
NAME = uuid.uuid4().hex
21-
OTHER_NAME = uuid.uuid4().hex
2220
HEADERS = ['Name']
2321
FIELDS = ['name']
2422

2523
@classmethod
2624
def setUpClass(cls):
2725
common.NetworkTests.setUpClass()
2826
if cls.haz_network:
27+
cls.NAME = uuid.uuid4().hex
28+
cls.OTHER_NAME = uuid.uuid4().hex
29+
2930
opts = cls.get_opts(cls.FIELDS)
3031
raw_output = cls.openstack(
3132
'security group create ' +

openstackclient/tests/functional/network/v2/test_security_group_rule.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
class SecurityGroupRuleTests(common.NetworkTests):
1919
"""Functional tests for security group rule"""
20-
SECURITY_GROUP_NAME = uuid.uuid4().hex
2120
SECURITY_GROUP_RULE_ID = None
2221
NAME_FIELD = ['name']
2322
ID_FIELD = ['id']
@@ -27,7 +26,9 @@ class SecurityGroupRuleTests(common.NetworkTests):
2726
def setUpClass(cls):
2827
common.NetworkTests.setUpClass()
2928
if cls.haz_network:
30-
# Create the security group to hold the rule.
29+
cls.SECURITY_GROUP_NAME = uuid.uuid4().hex
30+
31+
# Create the security group to hold the rule
3132
opts = cls.get_opts(cls.NAME_FIELD)
3233
raw_output = cls.openstack(
3334
'security group create ' +

0 commit comments

Comments
 (0)