Fix MismatchError in tags API tests
The tags lists are compared unsorted which causes a MismatchError
in some cases.
This commit sorts the tags lists before the assertion.
Story 2008026
Task 40680
Change-Id: I4cc8a663d7d7c853e6286379eea74c90819209cd
diff --git a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
index 8001899..5f4be23 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
@@ -157,7 +157,7 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(hw_tags, hm[const.TAGS])
+ self.assertCountEqual(hm_kwargs[const.TAGS], hm[const.TAGS])
# Helper functions for test healthmonitor list
def _filter_hms_by_pool_id(self, hms, pool_ids):
@@ -706,7 +706,7 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(hw_tags, hm[const.TAGS])
+ self.assertCountEqual(hm_kwargs[const.TAGS], hm[const.TAGS])
# Test that a user, without the loadbalancer member role, cannot
# use this command
@@ -787,7 +787,7 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- equal_items.append(const.TAGS)
+ self.assertCountEqual(hm_update_kwargs[const.TAGS], hm[const.TAGS])
for item in equal_items:
self.assertEqual(hm_update_kwargs[item], hm[item])
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
index b99706b..419a20f 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
@@ -212,7 +212,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(l7_policy_tags, l7policy[const.TAGS])
+ self.assertCountEqual(l7policy_kwargs[const.TAGS],
+ l7policy[const.TAGS])
@decorators.idempotent_id('42fa14ba-caf1-465e-ab36-27e7501f95ef')
def test_l7policy_list(self):
@@ -729,7 +730,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(l7_policy_tags, l7policy[const.TAGS])
+ self.assertCountEqual(l7policy_kwargs[const.TAGS],
+ l7policy[const.TAGS])
# Test that a user, without the load balancer member role, cannot
# use this command
@@ -821,8 +823,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(l7_policy_new_tags,
- l7policy[const.TAGS])
+ self.assertCountEqual(l7policy_update_kwargs[const.TAGS],
+ l7policy[const.TAGS])
@decorators.idempotent_id('7925eb4b-94b6-4c28-98c2-fd0b4f0976cc')
def test_l7policy_delete(self):
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
index e954b84..c2526bf 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
@@ -202,7 +202,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(l7_rule_tags, l7rule[const.TAGS])
+ self.assertCountEqual(l7rule_kwargs[const.TAGS],
+ l7rule[const.TAGS])
@decorators.idempotent_id('69095254-f106-4fb6-9f54-7a78cc14fb51')
def test_l7rule_list(self):
@@ -620,7 +621,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- equal_items.append(const.TAGS)
+ self.assertCountEqual(l7rule_kwargs[const.TAGS],
+ l7rule[const.TAGS])
for item in equal_items:
self.assertEqual(l7rule_kwargs[item], l7rule[item])
@@ -699,7 +701,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- equal_items.append(const.TAGS)
+ self.assertCountEqual(l7rule_update_kwargs[const.TAGS],
+ l7rule[const.TAGS])
for item in equal_items:
self.assertEqual(l7rule_update_kwargs[item], l7rule[item])
diff --git a/octavia_tempest_plugin/tests/api/v2/test_listener.py b/octavia_tempest_plugin/tests/api/v2/test_listener.py
index 81af3e3..fb542ce 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_listener.py
@@ -174,8 +174,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(sorted(listener_tags),
- sorted(listener[const.TAGS]))
+ self.assertCountEqual(listener_kwargs[const.TAGS],
+ listener[const.TAGS])
@decorators.idempotent_id('cceac303-4db5-4d5a-9f6e-ff33780a5f29')
def test_listener_create_on_same_port(self):
@@ -682,7 +682,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- equal_items.append(const.TAGS)
+ self.assertCountEqual(listener_kwargs[const.TAGS],
+ listener[const.TAGS])
for item in equal_items:
self.assertEqual(listener_kwargs[item], listener[item])
@@ -821,7 +822,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(listener_tags, listener[const.TAGS])
+ self.assertCountEqual(listener_kwargs[const.TAGS],
+ listener[const.TAGS])
# Test that a user, without the load balancer member role, cannot
# use this command
@@ -931,7 +933,8 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(listener_updated_tags, listener[const.TAGS])
+ self.assertCountEqual(listener_update_kwargs[const.TAGS],
+ listener[const.TAGS])
@decorators.idempotent_id('16f11c82-f069-4592-8954-81b35a98e3b7')
def test_listener_delete(self):
diff --git a/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py b/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
index 409630c..684eddb 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
@@ -148,7 +148,7 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(lb_tags, lb[const.TAGS])
+ self.assertCountEqual(lb_kwargs[const.TAGS], lb[const.TAGS])
@decorators.idempotent_id('643ef031-c800-45f2-b229-3c8f8b37c829')
def test_load_balancer_delete(self):
@@ -673,7 +673,7 @@
if self.mem_listener_client.is_version_supported(
self.api_version, '2.5'):
- self.assertEqual(lb_tags, lb[const.TAGS])
+ self.assertCountEqual(lb_kwargs[const.TAGS], lb[const.TAGS])
new_name = data_utils.rand_name("lb_member_lb1-update")
new_description = data_utils.arbitrary_string(size=255,
@@ -735,7 +735,7 @@
self.assertTrue(lb[const.ADMIN_STATE_UP])
self.assertEqual(new_description, lb[const.DESCRIPTION])
self.assertEqual(new_name, lb[const.NAME])
- self.assertEqual(new_tags, lb[const.TAGS])
+ self.assertCountEqual(lb_update_kwargs[const.TAGS], lb[const.TAGS])
# TODO(johnsom) Add QoS
# Attempt to clean up so that one full test run doesn't start 10+
diff --git a/octavia_tempest_plugin/tests/api/v2/test_member.py b/octavia_tempest_plugin/tests/api/v2/test_member.py
index f4bd2a8..583f93e 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_member.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_member.py
@@ -206,7 +206,8 @@
if self.mem_member_client.is_version_supported(
self.api_version, '2.5'):
- equal_items.append(const.TAGS)
+ self.assertCountEqual(member_kwargs[const.TAGS],
+ member[const.TAGS])
if monitor:
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
@@ -672,7 +673,8 @@
if self.mem_member_client.is_version_supported(
self.api_version, '2.5'):
- equal_items.append(const.TAGS)
+ self.assertCountEqual(member_kwargs[const.TAGS],
+ member[const.TAGS])
if monitor:
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
@@ -784,7 +786,8 @@
if self.mem_member_client.is_version_supported(
self.api_version, '2.5'):
- equal_items.append(const.TAGS)
+ self.assertCountEqual(member_update_kwargs[const.TAGS],
+ member[const.TAGS])
if monitor:
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
diff --git a/octavia_tempest_plugin/tests/api/v2/test_pool.py b/octavia_tempest_plugin/tests/api/v2/test_pool.py
index 36d1927..88e0119 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_pool.py
@@ -187,7 +187,8 @@
pool[const.SESSION_PERSISTENCE][
const.COOKIE_NAME])
if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
- self.assertEqual(pool_tags, pool[const.TAGS])
+ self.assertCountEqual(pool_kwargs[const.TAGS],
+ pool[const.TAGS])
@decorators.idempotent_id('6959a32e-fb34-4f3e-be68-8880c6450016')
def test_pool_list(self):
@@ -670,7 +671,8 @@
self.assertFalse(pool_check[const.ADMIN_STATE_UP])
if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
- self.assertEqual(pool_tags, pool[const.TAGS])
+ self.assertCountEqual(pool_kwargs[const.TAGS],
+ pool[const.TAGS])
new_name = data_utils.rand_name("lb_member_pool1-UPDATED")
new_description = data_utils.arbitrary_string(size=255,
@@ -719,6 +721,10 @@
self.assertIsNone(
pool[const.SESSION_PERSISTENCE].get(const.COOKIE_NAME))
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ self.assertCountEqual(pool_update_kwargs[const.TAGS],
+ pool[const.TAGS])
+
# Also test removing a Session Persistence
if self.lb_feature_enabled.session_persistence_enabled:
pool_update_kwargs = {
@@ -741,9 +747,6 @@
if self.lb_feature_enabled.session_persistence_enabled:
self.assertIsNone(pool.get(const.SESSION_PERSISTENCE))
- if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
- self.assertEqual(new_tags, pool[const.TAGS])
-
@decorators.idempotent_id('35ed3800-7a4a-47a6-9b94-c1033fff1112')
def test_pool_delete(self):
"""Tests pool create and delete APIs.