Rev 2567: Add test for https://bugs.launchpad.net/bzr/+bug/109169 -- test_failed_lock_leaves_no_trash in http://sourcefrog.net/bzr/dlock

Martin Pool mbp at sourcefrog.net
Thu Jun 28 09:09:02 BST 2007


At http://sourcefrog.net/bzr/dlock

------------------------------------------------------------
revno: 2567
revision-id: mbp at sourcefrog.net-20070628080901-o0xsxrgsqodeqvcu
parent: mbp at sourcefrog.net-20070628075315-ewq68yfptqwx7nj8
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: dlock
timestamp: Thu 2007-06-28 18:09:01 +1000
message:
  Add test for https://bugs.launchpad.net/bzr/+bug/109169 -- test_failed_lock_leaves_no_trash
modified:
  bzrlib/tests/test_lockdir.py   test_lockdir.py-20060220222025-33d4221569a3d600
=== modified file 'bzrlib/tests/test_lockdir.py'
--- a/bzrlib/tests/test_lockdir.py	2007-06-28 06:06:30 +0000
+++ b/bzrlib/tests/test_lockdir.py	2007-06-28 08:09:01 +0000
@@ -648,3 +648,22 @@
         e = self.assertRaises(errors.LockError, ld2.attempt_lock)
         self.assertContainsRe(str(e),
                 "rename succeeded, but lock is still held by someone else")
+
+    def test_failed_lock_leaves_no_trash(self):
+        # if we fail to acquire the lock, we don't leave pending directories
+        # behind -- https://bugs.launchpad.net/bzr/+bug/109169
+        ld1 = self.get_lock()
+        ld2 = self.get_lock()
+        # should be nothing before we start
+        ld1.create()
+        t = self.get_transport().clone('test_lock')
+        def check_dir(a):
+            self.assertEquals(a, t.list_dir('.'))
+        check_dir([])
+        # when held, that's all we see
+        ld1.attempt_lock()
+        check_dir(['held'])
+        # second guy should fail
+        self.assertRaises(errors.LockContention, ld2.attempt_lock)
+        # no kibble
+        check_dir(['held'])




More information about the bazaar-commits mailing list