aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/benchmark/scenarios
diff options
context:
space:
mode:
authorAbhijit Sinha <abhijit.sinha@intel.com>2018-06-26 15:15:02 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-06-26 15:15:02 +0000
commitb0699552d6b308d6ce458c456a3ece99ae9069a6 (patch)
tree7f4cd98e7a9607e92b2469619c9a10e3aa849866 /yardstick/tests/unit/benchmark/scenarios
parentda8e2c813048e70956e6dcb54b997e8e6bfb9ebf (diff)
parent736f3fa5d52345d6fe5174b83de043f779fa0600 (diff)
Merge "Bugfix: HA kill process recovery has a conflict"
Diffstat (limited to 'yardstick/tests/unit/benchmark/scenarios')
-rw-r--r--yardstick/tests/unit/benchmark/scenarios/availability/test_serviceha.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/yardstick/tests/unit/benchmark/scenarios/availability/test_serviceha.py b/yardstick/tests/unit/benchmark/scenarios/availability/test_serviceha.py
index cf1e76d7a..ec0e5973c 100644
--- a/yardstick/tests/unit/benchmark/scenarios/availability/test_serviceha.py
+++ b/yardstick/tests/unit/benchmark/scenarios/availability/test_serviceha.py
@@ -43,6 +43,13 @@ class ServicehaTestCase(unittest.TestCase):
}
sla = {"outage_time": 5}
self.args = {"options": options, "sla": sla}
+ self.test__serviceha = serviceha.ServiceHA(self.args, self.ctx)
+
+ def test___init__(self):
+
+ self.assertEqual(self.test__serviceha.data, {})
+ self.assertFalse(self.test__serviceha.setup_done)
+ self.assertFalse(self.test__serviceha.sla_pass)
# NOTE(elfoley): This should be split into test_setup and test_run
# NOTE(elfoley): This should explicitly test outcomes and states
@@ -90,3 +97,18 @@ class ServicehaTestCase(unittest.TestCase):
ret = {}
self.assertRaises(y_exc.SLAValidationError, p.run, ret)
self.assertEqual(ret['sla_pass'], 0)
+
+ @mock.patch.object(serviceha, 'baseattacker')
+ @mock.patch.object(serviceha, 'basemonitor')
+ def test__serviceha_no_teardown_when_sla_pass(self, mock_monitor,
+ *args):
+ p = serviceha.ServiceHA(self.args, self.ctx)
+ p.setup()
+ self.assertTrue(p.setup_done)
+ mock_monitor.MonitorMgr().verify_SLA.return_value = True
+ ret = {}
+ p.run(ret)
+ attacker = mock.Mock()
+ p.attackers = [attacker]
+ p.teardown()
+ attacker.recover.assert_not_called()