Update end to end test for Threshold rule
""" Test end to end flow with:
Notification service with
- OverMaxRule & UnderMinRule in-built rules plugin
+ Threshold in-built rule plugin
notify-python35 delivery channel plugin
"""
@@ -30,7 +30,7 @@ __version__ = "${VERSION}"
SERVICE = "notification"
SERVICE_NAME = "NotificationServer #1"
NOTIFY_PLUGIN = "python35"
-NOTIFY_INBUILT_RULES = ["OverMaxRule", "UnderMinRule"]
+NOTIFY_INBUILT_RULES = ["Threshold"]
def _configure_and_start_service(service_branch, foglamp_url, remove_directories):
@@ -139,9 +139,8 @@ class TestNotificationService:
remove_directories(os.environ['FOGLAMP_ROOT'] + 'cmake_build/C/plugins/notificationRule')
jdoc = _get_result(foglamp_url, '/foglamp/notification/plugin')
assert [] == jdoc['delivery']
- assert 2 == len(jdoc['rules'])
+ assert 1 == len(jdoc['rules'])
assert NOTIFY_INBUILT_RULES[0] == jdoc['rules'][0]['name']
- assert NOTIFY_INBUILT_RULES[1] == jdoc['rules'][1]['name']
class TestNotificationCRUD:
@@ -165,9 +164,8 @@ class TestNotificationCRUD:
jdoc = _get_result(foglamp_url, '/foglamp/notification/plugin')
assert 1 == len(jdoc['delivery'])
assert NOTIFY_PLUGIN == jdoc['delivery'][0]['name']
- assert 2 == len(jdoc['rules'])
+ assert 1 == len(jdoc['rules'])
assert NOTIFY_INBUILT_RULES[0] == jdoc['rules'][0]['name']
- assert NOTIFY_INBUILT_RULES[1] == jdoc['rules'][1]['name']
def test_get_notifications_and_audit_entry(self, foglamp_url):
jdoc = _get_result(foglamp_url, '/foglamp/notification')
@@ -278,7 +276,8 @@ class TestSentAndReceiveNotification:
data = {"asset": self.ASSET_NAME,
"datapoint": "sensor",
"evaluation_type": "latest",
- "trigger_value": str(self.SENSOR_VALUE + 1),
+ "condition": ">",
+ "trigger_value": str(self.SENSOR_VALUE - 10),
}
conn.request("PUT", '/foglamp/category/rule{}'.format(cat_name), json.dumps(data))
r = conn.getresponse()
@@ -295,7 +294,7 @@ class TestSentAndReceiveNotification:
def test_sent_and_receive_notification(self, foglamp_url, start_south, wait_time):
data = {"name": "Test4",
"description": "Test4_Notification",
- "rule": NOTIFY_INBUILT_RULES[1],
+ "rule": NOTIFY_INBUILT_RULES[0],
"channel": NOTIFY_PLUGIN,
"enabled": True,
"notification_type": "one shot"
