コード例 #1
0
    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")
コード例 #2
0
 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")
コード例 #3
0
 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")
コード例 #4
0
 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")
コード例 #5
0
 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")