From caf17e04c86cb52d99cf606635d74f05597b37d8 Mon Sep 17 00:00:00 2001
From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk>
Date: Tue, 18 Sep 2018 08:28:50 +0100
Subject: [PATCH] Updates alerts test - replaced the cpu usage alert rule,
 causing issues when running on givry

---
 src/test/clmctest/alerts/alerts_test_config.yaml   | 14 +++++++-------
 src/test/clmctest/alerts/conftest.py               |  2 +-
 .../clmctest/alerts/resources_test_config.yaml     |  2 +-
 src/test/clmctest/alerts/test_alerts.py            |  2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/test/clmctest/alerts/alerts_test_config.yaml b/src/test/clmctest/alerts/alerts_test_config.yaml
index c2e9332..c2600f0 100644
--- a/src/test/clmctest/alerts/alerts_test_config.yaml
+++ b/src/test/clmctest/alerts/alerts_test_config.yaml
@@ -31,18 +31,18 @@ topology_template:
             action:
               implementation:
                 - http://172.40.231.200:9999/
-          high_cpu_usage:
-            description: This event triggers when the cpu system usage is too high.
+          increase_in_running_processes:
+            description: This event triggers when the max number of running processes increases.
             event_type: threshold
-            metric: cpu.usage_system
+            metric: processes.running
             condition:
-              threshold: 10
-              granularity: 10
-              aggregation_method: mean
+              threshold: 1
+              granularity: 12
+              aggregation_method: max
               resource_type:
                 flame_location: DC1
                 flame_sfp: nginx
-              comparison_operator: lte
+              comparison_operator: gte
             action:
               implementation:
                 - http://172.40.231.200:9999/
diff --git a/src/test/clmctest/alerts/conftest.py b/src/test/clmctest/alerts/conftest.py
index 73a65b7..02d004d 100644
--- a/src/test/clmctest/alerts/conftest.py
+++ b/src/test/clmctest/alerts/conftest.py
@@ -54,7 +54,7 @@ def rspec_config():
     return data_loaded
 
 
-@fixture(autouse=True, scope="module")
+@fixture(scope="module")
 def set_up_tear_down_fixture(rspec_config):
     """
     Set up/tear down fixture for the alerts integration test.
diff --git a/src/test/clmctest/alerts/resources_test_config.yaml b/src/test/clmctest/alerts/resources_test_config.yaml
index 45591f1..061c227 100644
--- a/src/test/clmctest/alerts/resources_test_config.yaml
+++ b/src/test/clmctest/alerts/resources_test_config.yaml
@@ -85,7 +85,7 @@ topology_template:
                     Bristol: eu.ict-flame.sfe.state.lifecycle.connected
           tigger_b:
             condition:
-              constraint: clmc::high_cpu_usage
+              constraint: clmc::increase_in_running_processes
               period: 600 # integer required, unit: seconds
             action:
               frontend:
diff --git a/src/test/clmctest/alerts/test_alerts.py b/src/test/clmctest/alerts/test_alerts.py
index e5535f4..59fefb4 100644
--- a/src/test/clmctest/alerts/test_alerts.py
+++ b/src/test/clmctest/alerts/test_alerts.py
@@ -35,7 +35,7 @@ NGINX_PORT = 80
 
 class TestAlerts(object):
 
-    def test_alert_triggers(self, rspec_config):
+    def test_alert_triggers(self, rspec_config, set_up_tear_down_fixture):
         """
         Test is implemented using the following steps:
             * Send clmc service a TOSCA alert spec. file
-- 
GitLab