Do not fail test case when no vpp pid detected in the tear down 96/6896/5
authorJan Gelety <jgelety@cisco.com>
Mon, 29 May 2017 10:07:58 +0000 (12:07 +0200)
committerJan Gelety <jgelety@cisco.com>
Tue, 30 May 2017 10:01:08 +0000 (10:01 +0000)
- currently when no pid (or more pids) detected in the test case
  tear down of successfully run test case not only the WARN message
  is logged but the whole test case is failed

- to change this behaviour but keep test case failure if no vpp pid
  (or more vpp pids) detected in test case setup the low level KW
  "Get VPP PID" behaviour has been changed to return one or more
  pids or None w/o raising an error and check has been moved to
  higher level KW "Save VPP PIDs"

- there was added suite name and test case name to WARN message when
  no pid or more pids detected in the test case tear down

Change-Id: I04f8d81c1ca48a1e4a45bd0e58f00d36d51c6933
Signed-off-by: Jan Gelety <jgelety@cisco.com>
resources/libraries/python/DUTSetup.py
resources/libraries/robot/default.robot

index dabdfce..4834ba6 100644 (file)
@@ -127,11 +127,16 @@ class DUTSetup(object):
         if len(stdout.splitlines()) == 1:
             return int(stdout)
         elif len(stdout.splitlines()) == 0:
         if len(stdout.splitlines()) == 1:
             return int(stdout)
         elif len(stdout.splitlines()) == 0:
-            raise RuntimeError("No VPP PID found on node {0}".
-                               format(node['host']))
+            logger.debug("No VPP PID found on node {0}".
+                         format(node['host']))
+            return None
         else:
         else:
-            raise RuntimeError("More then one VPP PID found on node {0}".
-                               format(node['host']))
+            logger.debug("More then one VPP PID found on node {0}".
+                         format(node['host']))
+            ret_list = ()
+            for line in stdout.splitlines():
+                ret_list.append(int(line))
+            return ret_list
 
     @staticmethod
     def get_vpp_pids(nodes):
 
     @staticmethod
     def get_vpp_pids(nodes):
index 05314d6..fd1b280 100644 (file)
 | | ... | where the key is the host and the value is the PID.
 | | ...
 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
 | | ... | where the key is the host and the value is the PID.
 | | ...
 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
+| | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
+| | :FOR | ${key} | IN | @{keys}
+| | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
+| | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
+| | | Run Keyword If | ',' in '${pid}'
+| | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
 | | Set Test Variable | ${setup_vpp_pids}
 
 | Check VPP PID in Teardown
 | | Set Test Variable | ${setup_vpp_pids}
 
 | Check VPP PID in Teardown
 | | ... | is printed on console and to log. The test will not fail.
 | | ...
 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
 | | ... | is printed on console and to log. The test will not fail.
 | | ...
 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
-| | ${err_msg}= | Catenate | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
+| | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
+| | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
 | | ${rc} | ${msg}= | Run keyword and ignore error
 | | ... | Dictionaries Should Be Equal
 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
 | | ${rc} | ${msg}= | Run keyword and ignore error
 | | ... | Dictionaries Should Be Equal