tests: fix assert_nothing_captured
Type: fix
Fixes: 26cd0242c9
Change-Id: I9a88221af65f170dc6b1f0dc0992df401e489fa2
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
This commit is contained in:

committed by
Ole Tr�an

parent
8eeb851d6f
commit
16ce09db9e
@ -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
|
||||
|
Reference in New Issue
Block a user