diff options
author | Miikka Koistinen <miikka.koistinen@nokia.com> | 2018-06-08 13:54:48 +0300 |
---|---|---|
committer | Emma Foley <emma.l.foley@intel.com> | 2018-06-28 11:26:39 +0100 |
commit | eaebb40c960284d7d4ce9ad6221cba32c04a2827 (patch) | |
tree | 083aef2a3eaa90981665a0947255dd3e20fdb1b6 /yardstick/benchmark/scenarios/availability/serviceha.py | |
parent | 441d5f55a6e2e155d01d4b396678d0d09bfb8413 (diff) |
Convert SLA asserts to raises
This commit converts Python assertions to a custom exception in all
places where SLA validation is checked with an assertion.
This commit also fixes all emerged pylint errors.
JIRA: YARDSTICK-966
Change-Id: If771ed03b2cbc0a43a57fcfb9293f18740b3ff80
Signed-off-by: Miikka Koistinen <miikka.koistinen@nokia.com>
(cherry picked from 39f80e9b06395ae1515cfcf08508504ad4dd978a)
Diffstat (limited to 'yardstick/benchmark/scenarios/availability/serviceha.py')
-rwxr-xr-x | yardstick/benchmark/scenarios/availability/serviceha.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/yardstick/benchmark/scenarios/availability/serviceha.py b/yardstick/benchmark/scenarios/availability/serviceha.py index ee2eeb007..31caf50bd 100755 --- a/yardstick/benchmark/scenarios/availability/serviceha.py +++ b/yardstick/benchmark/scenarios/availability/serviceha.py @@ -71,6 +71,7 @@ class ServiceHA(base.Scenario): LOG.info("Monitor '%s' stop!", self.__scenario_type__) self.sla_pass = self.monitorMgr.verify_SLA() + service_not_found = False for k, v in self.data.items(): if v == 0: self.sla_pass = False @@ -79,9 +80,10 @@ class ServiceHA(base.Scenario): result['sla_pass'] = 1 if self.sla_pass else 0 self.monitorMgr.store_result(result) - assert self.sla_pass is True, "The HA test case NOT pass the SLA" - - return + self.verify_SLA( + self.sla_pass, ("a service process was not found in the host " + "environment" if service_not_found + else "MonitorMgr.verify_SLA() failed")) def teardown(self): """scenario teardown""" |