Revision a18ab868 test/py/ganeti.backend_unittest.py
b/test/py/ganeti.backend_unittest.py | ||
---|---|---|
676 | 676 |
def testValid(self): |
677 | 677 |
path = "somepath" |
678 | 678 |
excl_stor = True |
679 |
orig_fn = backend._GetVgSpindlesInfo |
|
679 | 680 |
backend._GetVgSpindlesInfo = mock.Mock() |
680 | 681 |
backend._GetLvmPvSpaceInfo(path, [excl_stor]) |
681 | 682 |
backend._GetVgSpindlesInfo.assert_called_with(path, excl_stor) |
683 |
backend._GetVgSpindlesInfo = orig_fn |
|
682 | 684 |
|
683 | 685 |
|
684 | 686 |
class TestCheckStorageParams(unittest.TestCase): |
... | ... | |
702 | 704 |
["b", False], 3) |
703 | 705 |
|
704 | 706 |
|
707 |
class TestGetVgSpindlesInfo(unittest.TestCase): |
|
708 |
|
|
709 |
def setUp(self): |
|
710 |
self.vg_free = 13 |
|
711 |
self.vg_size = 31 |
|
712 |
self.mock_fn = mock.Mock(return_value=(self.vg_free, self.vg_size)) |
|
713 |
|
|
714 |
def testValidInput(self): |
|
715 |
name = "myvg" |
|
716 |
excl_stor = True |
|
717 |
result = backend._GetVgSpindlesInfo(name, excl_stor, info_fn=self.mock_fn) |
|
718 |
self.mock_fn.assert_called_with(name) |
|
719 |
self.assertEqual(name, result["name"]) |
|
720 |
self.assertEqual(constants.ST_LVM_PV, result["type"]) |
|
721 |
self.assertEqual(self.vg_free, result["storage_free"]) |
|
722 |
self.assertEqual(self.vg_size, result["storage_size"]) |
|
723 |
|
|
724 |
def testNoExclStor(self): |
|
725 |
name = "myvg" |
|
726 |
excl_stor = False |
|
727 |
result = backend._GetVgSpindlesInfo(name, excl_stor, info_fn=self.mock_fn) |
|
728 |
self.mock_fn.assert_not_called() |
|
729 |
self.assertEqual(name, result["name"]) |
|
730 |
self.assertEqual(constants.ST_LVM_PV, result["type"]) |
|
731 |
self.assertEqual(0, result["storage_free"]) |
|
732 |
self.assertEqual(0, result["storage_size"]) |
|
733 |
|
|
734 |
|
|
705 | 735 |
class TestGetNodeInfo(unittest.TestCase): |
706 | 736 |
|
707 | 737 |
_SOME_RESULT = None |
Also available in: Unified diff