Use random name in qos test_list_policy_filter_by_name
test_list_policy_filter_by_name was looking for policies
with name 'test' and expected only one such policy to
be retrieved, but since tempest is running with multiple
concurrency and some other qos tests were also using same
policy name, this leads to test failure when this test
runs at same time with other such tests. This patch fixes
it by using random name for the policy for this test.
Closes-Bug: #1959184
Change-Id: Ibcbb2403b5b5983b2573c5a4791fb30850816d60
diff --git a/neutron_tempest_plugin/api/test_qos.py b/neutron_tempest_plugin/api/test_qos.py
index ebce45b..a85a037 100644
--- a/neutron_tempest_plugin/api/test_qos.py
+++ b/neutron_tempest_plugin/api/test_qos.py
@@ -87,17 +87,19 @@
@decorators.idempotent_id('f8d20e92-f06d-4805-b54f-230f77715815')
def test_list_policy_filter_by_name(self):
- self.create_qos_policy(name='test', description='test policy',
+ policy1 = 'test' + data_utils.rand_name("policy")
+ policy2 = 'test' + data_utils.rand_name("policy")
+ self.create_qos_policy(name=policy1, description='test policy',
shared=False)
- self.create_qos_policy(name='test2', description='test policy',
+ self.create_qos_policy(name=policy2, description='test policy',
shared=False)
policies = (self.admin_client.
- list_qos_policies(name='test')['policies'])
+ list_qos_policies(name=policy1)['policies'])
self.assertEqual(1, len(policies))
retrieved_policy = policies[0]
- self.assertEqual('test', retrieved_policy['name'])
+ self.assertEqual(policy1, retrieved_policy['name'])
@decorators.idempotent_id('dde0b449-a400-4a87-b5a5-4d1c413c917b')
def test_list_policy_sort_by_name(self):