def test_md_attach_by_mount_md_exists(self): self.assertEqual(0, len(self.p_scheme.mds)) self.assertEqual(0, len(self.p_scheme.fss)) expected_md = partition.Md('name', 'level') expected_fs = partition.Fs('name', mount='mount') self.p_scheme.mds.append(expected_md) self.p_scheme.fss.append(expected_fs) actual_md = self.p_scheme.md_attach_by_mount('device', 'mount') self.assertIn('device', actual_md.devices) self.assertEqual(expected_md, actual_md)
def test_md_by_mount(self): self.assertEqual(0, len(self.p_scheme.mds)) self.assertEqual(0, len(self.p_scheme.fss)) expected_md = partition.Md('name', 'level') expected_fs = partition.Fs('name', mount='mount') self.p_scheme.mds.append(expected_md) self.p_scheme.fss.append(expected_fs) self.p_scheme.fss.append( partition.Fs('wrong_name', mount='wrong_mount')) self.assertEqual(expected_md, self.p_scheme.md_by_mount('mount'))
def setUp(self): super(TestMD, self).setUp() self.md = partition.Md('name', 'level')
def test_md_by_name(self): self.assertEqual(0, len(self.p_scheme.mds)) expected_md = partition.Md('name', 'level') self.p_scheme.mds.append(expected_md) self.p_scheme.mds.append(partition.Md('wrong_name', 'level')) self.assertEqual(expected_md, self.p_scheme.md_by_name('name'))
def test_md_next_name_fail(self): self.p_scheme.mds = [ partition.Md('/dev/md%s' % x, 'level') for x in range(0, 128) ] self.assertRaises(errors.MDAlreadyExistsError, self.p_scheme.md_next_name)