fix ha issue when run tc050~tc054 in ci 25/34225/1
authorrexlee8776 <limingjiang@huawei.com>
Wed, 3 May 2017 07:58:12 +0000 (07:58 +0000)
committerJing Lu <lvjing5@huawei.com>
Thu, 4 May 2017 11:02:19 +0000 (11:02 +0000)
JIRA: YARDSTICK-634

Change-Id: I46681c7e8afe391eef9c5309470028167e911950
Signed-off-by: rexlee8776 <limingjiang@huawei.com>
(cherry picked from commit 71bbbdb18b5f8621b8b4ed9aa0e4fcc1e8882085)

tests/unit/benchmark/scenarios/availability/test_scenario_general.py
yardstick/benchmark/scenarios/availability/scenario_general.py
yardstick/benchmark/scenarios/availability/serviceha.py

index 593fc77..ea54fbb 100644 (file)
@@ -48,7 +48,7 @@ class ScenarioGeneralTestCase(unittest.TestCase):
     def test_scenario_general_all_successful(self, mock_director):
         ins = ScenarioGeneral(self.scenario_cfg, None)
         ins.setup()
-        ins.run(None)
+        ins.run({})
         ins.teardown()
 
     def test_scenario_general_exception(self, mock_director):
@@ -56,7 +56,7 @@ class ScenarioGeneralTestCase(unittest.TestCase):
         mock_obj = mock.Mock()
         mock_obj.createActionPlayer.side_effect = KeyError('Wrong')
         ins.director = mock_obj
-        ins.run(None)
+        ins.run({})
         ins.teardown()
 
     def test_scenario_general_case_fail(self, mock_director):
@@ -64,5 +64,5 @@ class ScenarioGeneralTestCase(unittest.TestCase):
         mock_obj = mock.Mock()
         mock_obj.verify.return_value = False
         ins.director = mock_obj
-        ins.run(None)
+        ins.run({})
         ins.teardown()
index a950ef9..689d33a 100644 (file)
@@ -29,7 +29,7 @@ class ScenarioGeneral(base.Scenario):
     def setup(self):
         self.director = Director(self.scenario_cfg, self.context_cfg)
 
-    def run(self, args):
+    def run(self, result):
         steps = self.scenario_cfg["options"]["steps"]
         orderedSteps = sorted(steps, key=lambda x: x['index'])
         for step in orderedSteps:
@@ -55,12 +55,14 @@ class ScenarioGeneral(base.Scenario):
 
         self.director.stopMonitors()
         if self.director.verify():
-            LOG.debug(
-                "\033[92m congratulations, "
-                "the test cases scenario is pass! \033[0m")
+            result['sla_pass'] = 1
+            LOG.info(
+                "\033[92m Congratulations, "
+                "the HA test case PASS! \033[0m")
         else:
-            LOG.debug(
-                "\033[91m aoh,the test cases scenario failed,"
+            result['sla_pass'] = 0
+            LOG.info(
+                "\033[91m Aoh, the HA test case FAIL,"
                 "please check the detail debug information! \033[0m")
 
     def teardown(self):
index e82e69b..69727de 100755 (executable)
@@ -59,20 +59,21 @@ class ServiceHA(base.Scenario):
             return
 
         self.monitorMgr.start_monitors()
-        LOG.info("monitor start!")
+        LOG.info("HA monitor start!")
 
         for attacker in self.attackers:
             attacker.inject_fault()
 
         self.monitorMgr.wait_monitors()
-        LOG.info("monitor stop!")
+        LOG.info("HA monitor stop!")
 
         sla_pass = self.monitorMgr.verify_SLA()
         if sla_pass:
             result['sla_pass'] = 1
+            LOG.info("The HA test case PASS the SLA")
         else:
             result['sla_pass'] = 0
-        assert sla_pass is True, "the test cases is not pass the SLA"
+        assert sla_pass is True, "The HA test case NOT pass the SLA"
 
         return