aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficGenerator.py
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2020-02-24 20:20:59 +0100
committerJan Gelety <jgelety@cisco.com>2020-02-25 11:41:41 +0000
commitcc02a78ee4480370ace4e22f0a346185c9a049af (patch)
treef6200c28ee731c2ddc4b4f1d7292b92c80962632 /resources/libraries/python/TrafficGenerator.py
parentbb17ef2ed01e4dd1448c65f6df0d117b73e18dc0 (diff)
FIX: avoid t-rex suite tear down action to fail successfull tests
- 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>
Diffstat (limited to 'resources/libraries/python/TrafficGenerator.py')
-rw-r--r--resources/libraries/python/TrafficGenerator.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index f48792db3d..c99ea36f71 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -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):