Merge "Replace assertDictContainsSubset"
diff --git a/telemetry_tempest_plugin/aodh/api/admin/test_alarming_api_admin.py b/telemetry_tempest_plugin/aodh/api/admin/test_alarming_api_admin.py
index a612716..0b6becb 100644
--- a/telemetry_tempest_plugin/aodh/api/admin/test_alarming_api_admin.py
+++ b/telemetry_tempest_plugin/aodh/api/admin/test_alarming_api_admin.py
@@ -63,7 +63,7 @@
alarm_actions=alarm_actions)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
- self.assertDictContainsSubset(self.rule, body['event_rule'])
+ self.assertLessEqual(self.rule.items(), body['event_rule'].items())
self.assertEqual(['test:', 'log:'], body['alarm_actions'])
# Verify not seen by non-admin
@@ -84,7 +84,7 @@
event_rule=self.rule)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
- self.assertDictContainsSubset(self.rule, body['event_rule'])
+ self.assertLessEqual(self.rule.items(), body['event_rule'].items())
# Verify initial state as non-admin
body = self.alarming_client.show_alarm(alarm_id)
diff --git a/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py b/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py
index 82cb2ea..0fd826b 100644
--- a/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py
+++ b/telemetry_tempest_plugin/aodh/api/gnocchi/test_alarming_api.py
@@ -51,9 +51,9 @@
)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
- self.assertDictContainsSubset(
- rule,
- body['gnocchi_aggregation_by_metrics_threshold_rule'])
+ self.assertLessEqual(
+ rule.items(),
+ body['gnocchi_aggregation_by_metrics_threshold_rule'].items())
# Update alarm with same rule and name
body = self.alarming_client.update_alarm(
@@ -63,9 +63,9 @@
type='gnocchi_aggregation_by_metrics_threshold',
gnocchi_aggregation_by_metrics_threshold_rule=rule)
self.assertEqual(alarm_name, body['name'])
- self.assertDictContainsSubset(
- rule,
- body['gnocchi_aggregation_by_metrics_threshold_rule'])
+ self.assertLessEqual(
+ rule.items(),
+ body['gnocchi_aggregation_by_metrics_threshold_rule'].items())
# Update alarm with new rule and new name
new_rule = {'metrics': ['41869681-5776-46d6-91ed-cccc43b6e4e3',
@@ -81,9 +81,9 @@
type='gnocchi_aggregation_by_metrics_threshold',
gnocchi_aggregation_by_metrics_threshold_rule=new_rule)
self.assertEqual(alarm_name_updated, body['name'])
- self.assertDictContainsSubset(
- new_rule,
- body['gnocchi_aggregation_by_metrics_threshold_rule'])
+ self.assertLessEqual(
+ new_rule.items(),
+ body['gnocchi_aggregation_by_metrics_threshold_rule'].items())
# Update severity
body = self.alarming_client.update_alarm(
@@ -97,9 +97,9 @@
# Get and verify details of an alarm after update
body = self.alarming_client.show_alarm(alarm_id)
self.assertEqual(alarm_name_updated, body['name'])
- self.assertDictContainsSubset(
- new_rule,
- body['gnocchi_aggregation_by_metrics_threshold_rule'])
+ self.assertLessEqual(
+ new_rule.items(),
+ body['gnocchi_aggregation_by_metrics_threshold_rule'].items())
self.assertEqual('low', body['severity'])
# Get history for the alarm and verify the same
diff --git a/telemetry_tempest_plugin/aodh/api/test_alarming_api.py b/telemetry_tempest_plugin/aodh/api/test_alarming_api.py
index 61fbe0e..66bdc5c 100644
--- a/telemetry_tempest_plugin/aodh/api/test_alarming_api.py
+++ b/telemetry_tempest_plugin/aodh/api/test_alarming_api.py
@@ -61,7 +61,7 @@
event_rule=self.rule)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
- self.assertDictContainsSubset(self.rule, body['event_rule'])
+ self.assertLessEqual(self.rule.items(), body['event_rule'].items())
# Update alarm with same rule and name
body = self.alarming_client.update_alarm(
@@ -70,7 +70,7 @@
name=alarm_name,
type='event')
self.assertEqual(alarm_name, body['name'])
- self.assertDictContainsSubset(self.rule, body['event_rule'])
+ self.assertLessEqual(self.rule.items(), body['event_rule'].items())
# Update alarm with new rule and new name
new_rule = {
@@ -88,7 +88,7 @@
name=alarm_name_updated,
type='event')
self.assertEqual(alarm_name_updated, body['name'])
- self.assertDictContainsSubset(new_rule, body['event_rule'])
+ self.assertLessEqual(new_rule.items(), body['event_rule'].items())
# Update severity
body = self.alarming_client.update_alarm(
@@ -101,7 +101,7 @@
# Get and verify details of an alarm after update
body = self.alarming_client.show_alarm(alarm_id)
self.assertEqual(alarm_name_updated, body['name'])
- self.assertDictContainsSubset(new_rule, body['event_rule'])
+ self.assertLessEqual(new_rule.items(), body['event_rule'].items())
self.assertEqual('low', body['severity'])
# Get history for the alarm and verify the same
@@ -138,7 +138,7 @@
event_rule=self.rule)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
- self.assertDictContainsSubset(self.rule, body['event_rule'])
+ self.assertLessEqual(self.rule.items(), body['event_rule'].items())
self.assertFalse(body['enabled'])
# Query by enabled false and verify
@@ -162,7 +162,7 @@
event_rule=self.rule)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
- self.assertDictContainsSubset(self.rule, body['event_rule'])
+ self.assertLessEqual(self.rule.items(), body['event_rule'].items())
# Verify default
expected_defaults = {
@@ -189,7 +189,7 @@
event_rule=self.rule)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
- self.assertDictContainsSubset(self.rule, body['event_rule'])
+ self.assertLessEqual(self.rule.items(), body['event_rule'].items())
# Verify initial state
body = self.alarming_client.show_alarm(alarm_id)