From: Andrew Bartlett Date: Thu, 21 Sep 2017 02:15:32 +0000 (+1200) Subject: ldb: Ensure we do not run out of File descriptors in autobuild X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=a65714a8e8f11a436da18f4dcb96c6d77590ed58;p=abartlet%2Fsamba.git%2F.git ldb: Ensure we do not run out of File descriptors in autobuild The python TestCase API will keep a reference to the test object until the end of the tests, long after we need the actual LDB or the fd. Signed-off-by: Andrew Bartlett --- diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py index ba9476a0e68..14bbdcb1718 100755 --- a/lib/ldb/tests/python/api.py +++ b/lib/ldb/tests/python/api.py @@ -55,6 +55,9 @@ class SimpleLdb(TestCase): def tearDown(self): shutil.rmtree(self.testdir) super(SimpleLdb, self).tearDown() + # Ensure the LDB is closed now, so we close the FD + del(self.ldb) + def test_connect(self): ldb.Ldb(self.filename) @@ -610,6 +613,10 @@ class SearchTests(TestCase): shutil.rmtree(self.testdir) super(SearchTests, self).tearDown() + # Ensure the LDB is closed now, so we close the FD + del(self.l) + + def setUp(self): super(SearchTests, self).setUp() self.testdir = tempdir() @@ -992,6 +999,9 @@ class AddModifyTests(TestCase): shutil.rmtree(self.testdir) super(AddModifyTests, self).tearDown() + # Ensure the LDB is closed now, so we close the FD + del(self.l) + def setUp(self): super(AddModifyTests, self).setUp() self.testdir = tempdir() @@ -1243,6 +1253,10 @@ class DnTests(TestCase): super(DnTests, self).setUp() self.ldb = ldb.Ldb() + def tearDown(self): + super(DnTests, self).tearDown() + del(self.ldb) + def test_set_dn_invalid(self): x = ldb.Message() def assign(): @@ -1863,6 +1877,8 @@ class LdbResultTests(TestCase): def tearDown(self): shutil.rmtree(self.testdir) super(LdbResultTests, self).tearDown() + # Ensure the LDB is closed now, so we close the FD + del(self.l) def test_return_type(self): res = self.l.search()