s4-test: Remove metadata and ldb.d directory on clean up
authorAmitay Isaacs <amitay@gmail.com>
Tue, 29 Nov 2011 00:15:05 +0000 (11:15 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 29 Nov 2011 05:00:36 +0000 (16:00 +1100)
When using partitions, metadata.tdb automatically gets created in
${prefix}ldb.d/ directory. To correctly clean up check if metadata.tdb
exists, then remove metadata.tdb and directory.

source4/scripting/python/samba/tests/samba3sam.py

index 63c9a4c1f4da44d55ac321b6ab8070905bea4a22..6b9ce7b3d43c533eef3902f14393a2e059778278 100644 (file)
@@ -122,6 +122,11 @@ class MapBaseTestCase(TestCaseInTempDir):
         os.unlink(self.ldbfile)
         os.unlink(self.samba3.file)
         os.unlink(self.samba4.file)
+        pdir = "%s.d" % self.ldbfile
+        mdata = os.path.join(pdir, "metadata.tdb")
+        if os.path.exists(mdata):
+            os.unlink(mdata)
+            os.rmdir(pdir)
         super(MapBaseTestCase, self).tearDown()
 
     def assertSidEquals(self, text, ndr_sid):