Commit e71d3def authored by Julien Muchembled's avatar Julien Muchembled

tests: fix resource leak in storage unit tests

MySQL connections remained open, which even led to deadlocks with MySQL 5.5

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2830 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bc9c252b
......@@ -56,6 +56,11 @@ class StorageClientHandlerTests(NeoUnitTestBase):
self.app.primary_master_node = pmn
self.master_port = 10010
def tearDown(self):
self.app.close()
del self.app
super(StorageClientHandlerTests, self).tearDown()
def _getConnection(self, uuid=None):
return self.getFakeConnection(uuid=uuid, address=('127.0.0.1', 1000))
......
......@@ -35,6 +35,11 @@ class StorageIdentificationHandlerTests(NeoUnitTestBase):
self.app.pt = PartitionTable(4, 1)
self.identification = IdentificationHandler(self.app)
def tearDown(self):
self.app.close()
del self.app
super(StorageIdentificationHandlerTests, self).tearDown()
def test_requestIdentification1(self):
""" nodes are rejected during election or if unknown storage """
self.app.ready = False
......
......@@ -43,6 +43,11 @@ class StorageInitializationHandlerTests(NeoUnitTestBase):
self.app.load_lock_dict = {}
self.app.pt = PartitionTable(self.num_partitions, self.num_replicas)
def tearDown(self):
self.app.close()
del self.app
super(StorageInitializationHandlerTests, self).tearDown()
# Common methods
def getLastUUID(self):
return self.uuid
......
......@@ -53,6 +53,11 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
self.app.primary_master_node = pmn
self.master_port = 10010
def tearDown(self):
self.app.close()
del self.app
super(StorageMasterHandlerTests, self).tearDown()
def getMasterConnection(self):
address = ("127.0.0.1", self.master_port)
return self.getFakeConnection(uuid=self.master_uuid, address=address)
......
......@@ -36,6 +36,11 @@ class StorageAppTests(NeoUnitTestBase):
self.app.event_queue = deque()
self.app.event_queue_dict = {}
def tearDown(self):
self.app.close()
del self.app
super(StorageAppTests, self).tearDown()
def test_01_loadPartitionTable(self):
self.app.dm = Mock({
'getPartitionTable': [],
......
......@@ -40,7 +40,7 @@ class StorageDBTests(NeoUnitTestBase):
def tearDown(self):
try:
del self._db
self.__dict__.pop('_db', None).close()
except AttributeError:
pass
NeoUnitTestBase.tearDown(self)
......
......@@ -44,6 +44,11 @@ class StorageVerificationHandlerTests(NeoUnitTestBase):
self.app.load_lock_dict = {}
self.app.pt = PartitionTable(self.num_partitions, self.num_replicas)
def tearDown(self):
self.app.close()
del self.app
super(StorageVerificationHandlerTests, self).tearDown()
# Common methods
def getLastUUID(self):
return self.uuid
......
......@@ -37,6 +37,11 @@ class BootstrapManagerTests(NeoUnitTestBase):
self.num_partitions = 1009
self.num_replicas = 2
def tearDown(self):
self.app.close()
del self.app
super(BootstrapManagerTests, self).tearDown()
# Common methods
def getLastUUID(self):
return self.uuid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment