The branch, master has been updated via 56400153c8c Revert TestCaseInSubDir parts of "downgradedatabase: blackbox test" via ab376a97c97 selftest: Specifically remove files generated by provision from 0d4738ee3b2 py3: Remove unused PyInt_AsSsize_t macro from py3compat.h
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 56400153c8c7052fe319f273c30c6d59556102dc Author: Andrew Bartlett <abart...@samba.org> Date: Fri May 31 12:47:13 2019 +1200 Revert TestCaseInSubDir parts of "downgradedatabase: blackbox test" This reverts part of commit 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45. TestCaseInSubDir should not have been modified in this way, instead the downgradedatabase test should have removed the files it created specifically (this is part of the test, it shows the right files were created). BUG: https://bugzilla.samba.org/show_bug.cgi?id=13978 Signed-off-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abart...@samba.org> Autobuild-Date(master): Fri Jun 7 21:08:12 UTC 2019 on sn-devel-184 commit ab376a97c972d2d5ebfb912ed90664c787860dc8 Author: Andrew Bartlett <abart...@samba.org> Date: Fri May 31 13:06:59 2019 +1200 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 <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> ----------------------------------------------------------------------- Summary of changes: python/samba/tests/__init__.py | 9 ++------- python/samba/tests/blackbox/downgradedatabase.py | 14 +++++++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) Changeset truncated at 500 lines: diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 03c21c2bc88..cbd164de1f9 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -19,7 +19,6 @@ """Samba Python tests.""" from __future__ import print_function import os -import shutil import tempfile import warnings import ldb @@ -295,15 +294,11 @@ class TestCaseInTempDir(TestCase): super(TestCaseInTempDir, self).setUp() self.tempdir = tempfile.mkdtemp() self.addCleanup(self._remove_tempdir) - self.check_tempdir_empty = True def _remove_tempdir(self): # Note asserting here is treated as an error rather than a test failure - if self.check_tempdir_empty: - self.assertEquals([], os.listdir(self.tempdir)) - os.rmdir(self.tempdir) - else: - shutil.rmtree(self.tempdir) + self.assertEquals([], os.listdir(self.tempdir)) + os.rmdir(self.tempdir) self.tempdir = None @contextmanager 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 -- Samba Shared Repository