summaryrefslogtreecommitdiffstats
path: root/test/functest/testcase_1.py
diff options
context:
space:
mode:
authorRomanos Skiadas <rski@intracom-telecom.com>2016-11-07 11:45:33 +0200
committerRomanos Skiadas <rski@intracom-telecom.com>2016-11-07 12:08:57 +0200
commit4db8c4108dcedae322ba6a3fde812e63f746d0f9 (patch)
tree7b836c092ae29b10ed59d44bf36d86569d92e1d5 /test/functest/testcase_1.py
parentb9eb7024b014cba0d299b1cf3b01e179c7d0482e (diff)
Refactor common code across tests
- Move collecting test results in a method in Results class - Create a util function for asserting the environment has enough compute nodes Change-Id: Ib7b9dfab7d2e9f50d5f352d3eadba4d4717ee750 Signed-off-by: Romanos Skiadas <rski@intracom-telecom.com>
Diffstat (limited to 'test/functest/testcase_1.py')
-rw-r--r--test/functest/testcase_1.py27
1 files changed, 2 insertions, 25 deletions
diff --git a/test/functest/testcase_1.py b/test/functest/testcase_1.py
index 4ad29b6..ad1e121 100644
--- a/test/functest/testcase_1.py
+++ b/test/functest/testcase_1.py
@@ -11,7 +11,6 @@
import argparse
import os
from random import randint
-import sys
import time
import functest.utils.functest_logger as ft_logger
@@ -128,16 +127,8 @@ def main():
sg_id = os_utils.create_security_group_full(neutron_client,
SECGROUP_NAME, SECGROUP_DESCR)
- # Get hypervisors zones
- compute_nodes = os_utils.get_hypervisors(nova_client)
- num_compute_nodes = len(compute_nodes)
- if num_compute_nodes < 2:
- logger.error("There are %s compute nodes in the deployment. "
- "Minimum number of nodes to complete the test is 2."
- % num_compute_nodes)
- sys.exit(-1)
+ compute_nodes = test_utils.assert_and_get_compute_nodes(nova_client)
- logger.debug("Compute nodes: %s" % compute_nodes)
av_zone_1 = "nova:" + compute_nodes[0]
av_zone_2 = "nova:" + compute_nodes[1]
@@ -292,21 +283,7 @@ def main():
results.get_ping_status(vm_1, vm_1_ip, vm_5, vm_5_ip,
expected="PASS", timeout=30)
- results.add_to_summary(0, "=")
- logger.info("\n%s" % results.summary)
-
- if results.test_result == "PASS":
- logger.info("All the ping tests have passed as expected.")
- else:
- logger.info("One or more ping tests have failed.")
-
- status = "PASS"
- success = 100 - \
- (100 * int(results.num_tests_failed) / int(results.num_tests))
- if success < int(SUCCESS_CRITERIA):
- status = "FAILED"
-
- return {"status": status, "details": results.details}
+ return results.compile_summary(SUCCESS_CRITERIA)
if __name__ == '__main__':