diff options
author | Klement Sekera <klement.sekera@gmail.com> | 2022-04-23 11:34:29 +0200 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2022-04-29 09:57:47 +0000 |
commit | 16ce09db9e3d7cf588037c80138438095a0ac200 (patch) | |
tree | da24ebad3bb76459b5ab1c08454ca5c0348310d6 /test/vpp_pg_interface.py | |
parent | 8eeb851d6f9a92911cf0e7f209d9aa31c707d26e (diff) |
tests: fix assert_nothing_captured
Type: fix
Fixes: 26cd0242c95025e0d644db3a80dfe8dee83b6d7a
Change-Id: I9a88221af65f170dc6b1f0dc0992df401e489fa2
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Diffstat (limited to 'test/vpp_pg_interface.py')
-rw-r--r-- | test/vpp_pg_interface.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py index 434a3005bd7..779eb0be6d9 100644 --- a/test/vpp_pg_interface.py +++ b/test/vpp_pg_interface.py @@ -296,6 +296,8 @@ class VppPGInterface(VppInterface): "expected %s packets on %s" % (len(capture.res), expected_count, name)) else: + if 0 == expected_count: + return raise Exception("No packets captured on %s" % name) def assert_nothing_captured(self, timeout=1, remark=None, @@ -306,24 +308,11 @@ class VppPGInterface(VppInterface): :param filter_out_fn: filter applied to each packet, packets for which the filter returns True are removed from capture """ - if os.path.isfile(self.out_path): - try: - capture = self.get_capture( - 0, timeout=timeout, remark=remark, - filter_out_fn=filter_out_fn) - if not capture or len(capture.res) == 0: - # junk filtered out, we're good - return - except: - pass - self.generate_debug_aid("empty-assert") - if remark: - raise UnexpectedPacketError( - capture[0], - f" ({len(capture)} packets captured in total) ({remark})") - else: - raise UnexpectedPacketError( - capture[0], f" ({len(capture)} packets captured in total)") + capture = self.get_capture(0, timeout=timeout, remark=remark, + filter_out_fn=filter_out_fn) + if not capture or len(capture.res) == 0: + # junk filtered out, we're good + return def wait_for_pg_stop(self): # wait till packet-generator is stopped |