aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/vnf/ims/heat_ims.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-04-23 16:49:55 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2019-04-24 20:25:14 +0200
commit9dcc30874194382a25c66baf359b863c6e013caf (patch)
tree421fa4ee80964f775fc1d0c0008e0afaf1ebe8ea /functest/opnfv_tests/vnf/ims/heat_ims.py
parentb9048a25355e1d6c29c84ca10a3d859841468f50 (diff)
Refactor modules to avoid duplicated code
It also increases number of lines to warm about duplicated codes. Change-Id: I3914da8a90cbfe8fd024e9944c3adc8a617330d3 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/vnf/ims/heat_ims.py')
-rw-r--r--functest/opnfv_tests/vnf/ims/heat_ims.py25
1 files changed, 5 insertions, 20 deletions
diff --git a/functest/opnfv_tests/vnf/ims/heat_ims.py b/functest/opnfv_tests/vnf/ims/heat_ims.py
index 7ad887bd0..cce1a330b 100644
--- a/functest/opnfv_tests/vnf/ims/heat_ims.py
+++ b/functest/opnfv_tests/vnf/ims/heat_ims.py
@@ -216,34 +216,19 @@ class HeatIms(singlevm.VmReady2):
def test_vnf(self):
"""Run test on clearwater ims instance."""
start_time = time.time()
-
outputs = self.cloud.get_stack(self.stack.id).outputs
self.__logger.debug("stack outputs: %s", outputs)
dns_ip = re.findall(r'[0-9]+(?:\.[0-9]+){3}', str(outputs))[0]
-
if not dns_ip:
return False
-
- short_result = self.clearwater.run_clearwater_live_test(
- dns_ip=dns_ip,
- public_domain=self.vnf['parameters']["zone"])
+ short_result, vnf_test_rate = self.clearwater.run_clearwater_live_test(
+ dns_ip=dns_ip, public_domain=self.vnf['parameters']["zone"])
duration = time.time() - start_time
self.__logger.info(short_result)
- self.details['test_vnf'] = dict(result=short_result,
- duration=duration)
- try:
- vnf_test_rate = short_result['passed'] / (
- short_result['total'] - short_result['skipped'])
- # orchestrator + vnf + test_vnf
- self.result += vnf_test_rate / 3 * 100
- except ZeroDivisionError:
- self.__logger.error("No test has been executed")
+ self.details['test_vnf'] = dict(result=short_result, duration=duration)
+ self.result += vnf_test_rate / 3 * 100
+ if vnf_test_rate == 0:
self.details['test_vnf'].update(status='FAIL')
- return False
- except Exception: # pylint: disable=broad-except
- self.__logger.exception("Cannot calculate results")
- self.details['test_vnf'].update(status='FAIL')
- return False
self._monit()
return True if vnf_test_rate > 0 else False