From: Andrew Bartlett Date: Fri, 31 May 2019 01:06:59 +0000 (+1200) Subject: selftest: Specifically remove files generated by provision X-Git-Tag: ldb-2.0.5~422 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab376a97c972d2d5ebfb912ed90664c787860dc8;p=thirdparty%2Fsamba.git selftest: Specifically remove files generated by provision This allows the changes in 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45 to be reverted, and aligns this test with others that use TestCaseInTempDir. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13978 Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/tests/blackbox/downgradedatabase.py b/python/samba/tests/blackbox/downgradedatabase.py index b0becacc068..a5e540c1354 100644 --- a/python/samba/tests/blackbox/downgradedatabase.py +++ b/python/samba/tests/blackbox/downgradedatabase.py @@ -19,6 +19,7 @@ from __future__ import print_function from samba.tests import BlackboxTestCase import os import ldb +import shutil from subprocess import check_output from samba.samdb import SamDB @@ -34,9 +35,6 @@ class DowngradeTestBase(BlackboxTestCase): if not hasattr(self, "backend"): self.fail("Subclass this class and set 'backend'") - # Don't assert on empty tempdir contents on tearDown - self.check_tempdir_empty = False - prov_cmd = "samba-tool domain provision " +\ "--domain FOO --realm foo.example.com " +\ "--targetdir {self.tempdir} " +\ @@ -59,6 +57,16 @@ class DowngradeTestBase(BlackboxTestCase): for p in partitions] self.dbs.append(self.sam_path) + def tearDown(self): + shutil.rmtree(os.path.join(self.tempdir, "private")) + shutil.rmtree(os.path.join(self.tempdir, "etc")) + shutil.rmtree(os.path.join(self.tempdir, "state")) + shutil.rmtree(os.path.join(self.tempdir, "bind-dns")) + shutil.rmtree(os.path.join(self.tempdir, "msg.lock")) + os.unlink(os.path.join(self.tempdir, "names.tdb")) + os.unlink(os.path.join(self.tempdir, "gencache.tdb")) + super(DowngradeTestBase, self).tearDown() + # Parse out the comments above each record that ldbdump produces # containing pack format version and KV level key for each record. # Return all GUID keys and DN keys (without @attrs), and the set