make test: reset object registry if vpp dies
Change-Id: If0e30837e07a21f3912676f5147cb242d3d2b235 Signed-off-by: Klement Sekera <ksekera@cisco.com>
This commit is contained in:
Klement Sekera
committed by
Damjan Marion
parent
80a7f0a81c
commit
1b68640930
@ -352,6 +352,8 @@ class VppTestCase(unittest.TestCase):
|
||||
os.rename(tmp_api_trace, vpp_api_trace_log)
|
||||
self.logger.info(self.vapi.ppcli("api trace dump %s" %
|
||||
vpp_api_trace_log))
|
||||
else:
|
||||
self.registry.unregister_all(self.logger)
|
||||
|
||||
def setUp(self):
|
||||
""" Clear trace before running each test"""
|
||||
|
@ -50,6 +50,12 @@ class VppObjectRegistry(object):
|
||||
else:
|
||||
logger.debug("REG: duplicate add, ignoring (%s)" % obj)
|
||||
|
||||
def unregister_all(self, logger):
|
||||
""" Remove all object registrations from registry. """
|
||||
logger.debug("REG: removing all object registrations")
|
||||
self._object_registry = []
|
||||
self._object_dict = dict()
|
||||
|
||||
def remove_vpp_config(self, logger):
|
||||
"""
|
||||
Remove configuration (if present) from vpp and then remove all objects
|
||||
@ -72,8 +78,7 @@ class VppObjectRegistry(object):
|
||||
for obj in self._object_registry:
|
||||
if obj.query_vpp_config():
|
||||
failed.append(obj)
|
||||
self._object_registry = []
|
||||
self._object_dict = dict()
|
||||
self.unregister_all(logger)
|
||||
if failed:
|
||||
logger.error("REG: Couldn't remove configuration for object(s):")
|
||||
for obj in failed:
|
||||
|
Reference in New Issue
Block a user