From b8bf181cafb0f4e8a317c308cfe83a3e022ce7c5 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Thu, 28 Jun 2018 07:29:06 +0000 Subject: SetupFramework to detect failures, part II - This patch is enforcing evaluation and aligning all __init__.robot files to use the same logic. Change-Id: I9e2bf5e904bb6d22f4e6a153c951c3b3c233e2fb Signed-off-by: Peter Mikus --- resources/libraries/python/SetupFramework.py | 14 ++++---------- tests/dpdk/perf/__init__.robot | 2 ++ tests/honeycomb/perf/__init__.robot | 2 ++ tests/kubernetes/perf/__init__.robot | 5 +++-- tests/vpp/perf/__init__.robot | 2 ++ 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/resources/libraries/python/SetupFramework.py b/resources/libraries/python/SetupFramework.py index 61a0234692..ccf4e4fada 100644 --- a/resources/libraries/python/SetupFramework.py +++ b/resources/libraries/python/SetupFramework.py @@ -224,8 +224,7 @@ class SetupFramework(object): :param nodes: Topology nodes. :type nodes: dict - :returns: True - success, False - error - :rtype: bool + :raises RuntimeError: If setup framework failed. """ tarball = pack_framework_dir() @@ -256,10 +255,8 @@ class SetupFramework(object): delete_local_tarball(tarball) if node_success: logger.console('All nodes are ready') - return True else: - logger.console('Failed to setup framework') - return False + raise RuntimeError('Failed to setup framework') class CleanupFramework(object): @@ -271,8 +268,7 @@ class CleanupFramework(object): :param nodes: Topology nodes. :type nodes: dict - :returns: True - success, False - error - :rtype: bool + :raises RuntimeError: If cleanup framework failed. """ # Turn off logging since we use multiprocessing log_level = BuiltIn().set_log_level('NONE') @@ -295,7 +291,5 @@ class CleanupFramework(object): if node_success: logger.console('All nodes cleaned up') - return True else: - logger.console('Failed to cleaned up framework') - return False + raise RuntimeError('Failed to cleaned up framework') diff --git a/tests/dpdk/perf/__init__.robot b/tests/dpdk/perf/__init__.robot index d7eebe6980..6d38c40229 100644 --- a/tests/dpdk/perf/__init__.robot +++ b/tests/dpdk/perf/__init__.robot @@ -15,6 +15,7 @@ | Resource | resources/libraries/robot/shared/default.robot | Resource | resources/libraries/robot/shared/interfaces.robot | Library | resources.libraries.python.SetupFramework +| Library | resources.libraries.python.SetupFramework.CleanupFramework | Library | resources.libraries.python.DPDK.DPDKTools | Suite Setup | Run Keywords | Setup performance global Variables | ... | AND | Setup Framework | ${nodes} @@ -22,6 +23,7 @@ | ... | AND | Get CPU Layout from all nodes | ${nodes} | ... | AND | Update All Numa Nodes | ... | ${nodes} | skip_tg=${True} +| Suite Teardown | Cleanup Framework | ${nodes} *** Keywords *** | Setup performance global Variables diff --git a/tests/honeycomb/perf/__init__.robot b/tests/honeycomb/perf/__init__.robot index a3d5a8ac5c..dba1392ce6 100644 --- a/tests/honeycomb/perf/__init__.robot +++ b/tests/honeycomb/perf/__init__.robot @@ -21,6 +21,7 @@ | Resource | resources/libraries/robot/honeycomb/honeycomb.robot | Resource | resources/libraries/robot/honeycomb/performance.robot | Library | resources.libraries.python.SetupFramework +| Library | resources.libraries.python.SetupFramework.CleanupFramework | Library | resources.libraries.python.CpuUtils | Library | resources.libraries.python.honeycomb.Performance | Suite Setup | Setup suite for Honeycomb performance tests @@ -28,6 +29,7 @@ | ... | Stop VPP Service on DUT | ${node} | ... | AND | Archive Honeycomb Logs | ${node} | perf=${True} | ... | AND | Stop honeycomb service on DUTs | ${node} +| ... | AND | Cleanup Framework | ${nodes} *** Keywords *** | Setup suite for Honeycomb performance tests diff --git a/tests/kubernetes/perf/__init__.robot b/tests/kubernetes/perf/__init__.robot index 686ead5e1c..69c6af3088 100644 --- a/tests/kubernetes/perf/__init__.robot +++ b/tests/kubernetes/perf/__init__.robot @@ -20,6 +20,7 @@ | Library | resources.libraries.python.NodePath | Library | resources.libraries.python.SchedUtils | Library | resources.libraries.python.SetupFramework +| Library | resources.libraries.python.SetupFramework.CleanupFramework | Library | resources.libraries.python.topology.Topology | Library | Collections | Suite Setup | Run Keywords | Setup performance global Variables @@ -29,8 +30,8 @@ | ... | AND | Update all numa nodes | ${nodes} | ... | skip_tg=${True} | ... | AND | Update NIC interface names on all duts | ${nodes} -| ... -| Suite Teardown | Destroy Kubernetes on all duts | ${nodes} +| Suite Teardown | Run Keywords | Destroy Kubernetes on all duts | ${nodes} +| ... | AND | Cleanup Framework | ${nodes} *** Keywords *** | Setup performance global Variables diff --git a/tests/vpp/perf/__init__.robot b/tests/vpp/perf/__init__.robot index aa95875dbb..642906dd22 100644 --- a/tests/vpp/perf/__init__.robot +++ b/tests/vpp/perf/__init__.robot @@ -15,6 +15,7 @@ | Resource | resources/libraries/robot/shared/default.robot | Resource | resources/libraries/robot/shared/interfaces.robot | Library | resources.libraries.python.SetupFramework +| Library | resources.libraries.python.SetupFramework.CleanupFramework | Library | resources.libraries.python.CpuUtils | Suite Setup | Run Keywords | Setup performance global Variables | ... | AND | Setup Framework | ${nodes} @@ -23,6 +24,7 @@ | ... | AND | Get CPU Layout from all nodes | ${nodes} | ... | AND | Update All Interface Data On All Nodes | ... | ${nodes} | skip_tg=${True} | numa_node=${True} +| Suite Teardown | Cleanup Framework | ${nodes} *** Keywords *** | Setup performance global Variables -- cgit 1.2.3-korg