def test_inq_lockspace_acquiring_wait(self): fs = FakeSanlock() fs.add_lockspace("lockspace", 1, "path", async=True) t = concurrent.thread(fs.complete_async, args=("lockspace", )) t.start() try: acquired = fs.inq_lockspace("lockspace", 1, "path", wait=True) finally: t.join() self.assertTrue(acquired, "lockspace not acquired")
def test_inq_lockspace_released(self): fs = FakeSanlock() fs.add_lockspace("lockspace", 1, "path") fs.rem_lockspace("lockspace", 1, "path") acquired = fs.inq_lockspace("lockspace", 1, "path") self.assertFalse(acquired, "lockspace not released")
def test_inq_lockspace_acquired(self): fs = FakeSanlock() fs.add_lockspace("lockspace", 1, "path") acquired = fs.inq_lockspace("lockspace", 1, "path") self.assertTrue(acquired, "lockspace not acquired")
def test_inq_lockspace_acquring_no_wait(self): fs = FakeSanlock() fs.add_lockspace("lockspace", 1, "path", async=True) acquired = fs.inq_lockspace("lockspace", 1, "path") self.assertIsNone(acquired, "lockspace is ready")
def test_inq_lockspace_releasing_no_wait(self): fs = FakeSanlock() fs.add_lockspace("lockspace", 1, "path") fs.rem_lockspace("lockspace", 1, "path", async=True) acquired = fs.inq_lockspace("lockspace", 1, "path") self.assertFalse(acquired, "lockspace not released")