1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

lvmdbustest: Factor out tearDown implementation for re-use

This commit is contained in:
Tony Asleson 2022-08-23 10:28:27 -05:00
parent de0258a600
commit d05d2328e0

View File

@ -419,9 +419,7 @@ class TestDbusService(unittest.TestCase):
rc = self._pv_remove(pv_proxy) rc = self._pv_remove(pv_proxy)
self.assertTrue(rc == '/') self.assertTrue(rc == '/')
def tearDown(self): def clean_up(self):
# If we get here it means we passed setUp, so lets remove anything
# and everything that remains, besides the PVs themselves
self.objs, self.bus = get_objects() self.objs, self.bus = get_objects()
# The self.objs[PV_INT] list only contains those which we should be # The self.objs[PV_INT] list only contains those which we should be
@ -447,7 +445,7 @@ class TestDbusService(unittest.TestCase):
# the properties are current and correct. # the properties are current and correct.
p.update() p.update()
if p.Pv.Vg != '/': if p.Pv.Vg != '/':
v = ClientProxy(self.bus, p.Pv.Vg, interfaces=(VG_INT, )) v = ClientProxy(self.bus, p.Pv.Vg, interfaces=(VG_INT,))
self._recurse_vg_delete(v, p, nested_pvs) self._recurse_vg_delete(v, p, nested_pvs)
# Check to make sure the PVs we had to start exist, else re-create # Check to make sure the PVs we had to start exist, else re-create
@ -465,6 +463,11 @@ class TestDbusService(unittest.TestCase):
# print('Re-creating PV=', p) # print('Re-creating PV=', p)
self._pv_create(p) self._pv_create(p)
def tearDown(self):
# If we get here it means we passed setUp, so lets remove anything
# and everything that remains, besides the PVs themselves
self.clean_up()
def _check_consistency(self): def _check_consistency(self):
# Only do consistency checks if we aren't running the unit tests # Only do consistency checks if we aren't running the unit tests
# concurrently # concurrently