Example #1
0
 def test_44_break_already_released(self):
     """Lock break races with regular release"""
     t = self.get_transport()
     lf1 = LockDir(t, 'test_lock')
     lf1.create()
     lf1.attempt_lock()
     # someone else sees it's still locked
     lf2 = LockDir(t, 'test_lock')
     holder_info = lf2.peek()
     # in the interim the lock is released
     lf1.unlock()
     # break should succeed
     lf2.force_break(holder_info)
     # now we should be able to take it
     lf2.attempt_lock()
     lf2.confirm()
Example #2
0
 def test_44_break_already_released(self):
     """Lock break races with regular release"""
     t = self.get_transport()
     lf1 = LockDir(t, 'test_lock')
     lf1.create()
     lf1.attempt_lock()
     # someone else sees it's still locked
     lf2 = LockDir(t, 'test_lock')
     holder_info = lf2.peek()
     # in the interim the lock is released
     lf1.unlock()
     # break should succeed
     lf2.force_break(holder_info)
     # now we should be able to take it
     lf2.attempt_lock()
     lf2.confirm()
Example #3
0
 def test_43_break(self):
     """Break a lock whose caller has forgotten it"""
     t = self.get_transport()
     lf1 = LockDir(t, 'test_lock')
     lf1.create()
     lf1.attempt_lock()
     # we incorrectly discard the lock object without unlocking it
     del lf1
     # someone else sees it's still locked
     lf2 = LockDir(t, 'test_lock')
     holder_info = lf2.peek()
     self.assertTrue(holder_info)
     lf2.force_break(holder_info)
     # now we should be able to take it
     lf2.attempt_lock()
     lf2.confirm()
Example #4
0
 def test_43_break(self):
     """Break a lock whose caller has forgotten it"""
     t = self.get_transport()
     lf1 = LockDir(t, 'test_lock')
     lf1.create()
     lf1.attempt_lock()
     # we incorrectly discard the lock object without unlocking it
     del lf1
     # someone else sees it's still locked
     lf2 = LockDir(t, 'test_lock')
     holder_info = lf2.peek()
     self.assertTrue(holder_info)
     lf2.force_break(holder_info)
     # now we should be able to take it
     lf2.attempt_lock()
     lf2.confirm()