FIX: avoid t-rex suite tear down action to fail successfull tests 21/25421/2
authorJan Gelety <jgelety@cisco.com>
Mon, 24 Feb 2020 19:20:59 +0000 (20:20 +0100)
committerJan Gelety <jgelety@cisco.com>
Tue, 25 Feb 2020 11:41:41 +0000 (11:41 +0000)
- try to kill t-rex only if it is running
- do not fail the whole test suite when t-rex test suite tear down
  action has failed

Change-Id: I3748a08a3da4dd3617cb54e8fdd344d49566fc7d
Signed-off-by: Jan Gelety <jgelety@cisco.com>
resources/libraries/python/TrafficGenerator.py
resources/libraries/robot/shared/suite_teardown.robot

index f48792d..c99ea36 100644 (file)
@@ -427,8 +427,11 @@ class TrafficGenerator(AbstractMeasurer):
         subtype = check_subtype(node)
         if subtype == NodeSubTypeTG.TREX:
             exec_cmd_no_error(
-                node, u"sh -c \"sudo pkill t-rex && sleep 3\"",
-                sudo=False, message=u"pkill t-rex failed"
+                node,
+                u"sh -c "
+                u"\"if pgrep t-rex; then sudo pkill t-rex && sleep 3; fi\"",
+                sudo=False,
+                message=u"pkill t-rex failed"
             )
 
     def _parse_traffic_results(self, stdout):
index f000679..362c736 100644 (file)
@@ -39,7 +39,7 @@
 | | [Documentation]
 | | ... | Additional teardown for suites which uses performance measurement.
 | |
-| | Teardown traffic generator | ${tg}
+| | Run Keyword And Ignore Error | Teardown traffic generator | ${tg}
 
 | Additional Suite Tear Down Action For dpdk
 | | [Documentation]