def testValidateExports(self): storage.PROC_FILESYSTEMS = 'testdata/storage/proc.filesystems' storage.PROC_MOUNTS = 'testdata/storage/proc.mounts' storage.SYS_BLOCK = 'testdata/storage/sys/block' service = storage.StorageServiceLinux26() service.ValidateExports() stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype') stor.ValidateExports() pm = storage.PhysicalMediumDiskLinux26('sda') pm.ValidateExports()
def testUsedSpace(self): stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype') teststatvfs = OsStatVfs('/fakepath') used = (teststatvfs.f_blocks - teststatvfs.f_bavail) * teststatvfs.f_bsize self.assertEqual(stor.UsedSpace, used / 1024 / 1024)
def testLogicalVolumeCapacity(self): stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype') teststatvfs = OsStatVfs('/fakepath') expected = teststatvfs.f_bsize * teststatvfs.f_blocks / 1024 / 1024 self.assertEqual(stor.Capacity, expected)
def testLogicalVolumeThresholdReached(self): stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype') stor.ThresholdLimit = 1 self.assertFalse(stor.ThresholdReached) stor.ThresholdLimit = 4 self.assertTrue(stor.ThresholdReached)
def testOsError(self): stor = storage.LogicalVolumeLinux26('/raise_os_error', 'fstype') self.assertEqual(stor.Capacity, 0)