def test_get_partial_image(self): loc = g_location.Location('test_rbd_store', rbd_store.StoreLocation, self.conf, store_specs=self.store_specs) self.assertRaises(exceptions.StoreRandomGetNotSupported, self.store.get, loc, chunk_size=1)
def test_partial_get(self): loc = location.Location('test_sheepdog_store', sheepdog.StoreLocation, self.conf, store_specs=self.store_specs) self.assertRaises(exceptions.StoreRandomGetNotSupported, self.store.get, loc, chunk_size=1)
def test_delete(self): def _fake_remove(*args, **kwargs): self.called_commands_actual.append('remove') with mock.patch.object(MockRBD.RBD, 'remove') as remove_image: remove_image.side_effect = _fake_remove self.store.delete(g_location.Location('test_rbd_store', rbd_store.StoreLocation, self.conf, uri=self.location.get_uri())) self.called_commands_expected = ['remove']
def test_get_size(self): def _fake_run_command(command, data, *params): if command == "list -r": return "= fake_volume 0 1000" with mock.patch.object(sheepdog.SheepdogImage, '_run_command') as cmd: cmd.side_effect = _fake_run_command loc = location.Location('test_sheepdog_store', sheepdog.StoreLocation, self.conf, store_specs=self.store_specs) ret = self.store.get_size(loc) self.assertEqual(1000, ret)
def test_delete(self): called_commands = [] def _fake_run_command(command, data, *params): called_commands.append(command) if command == "list -r": return "= fake_volume 0 1000" with mock.patch.object(sheepdog.SheepdogImage, '_run_command') as cmd: cmd.side_effect = _fake_run_command loc = location.Location('test_sheepdog_store', sheepdog.StoreLocation, self.conf, store_specs=self.store_specs) self.store.delete(loc) self.assertEqual(['list -r', 'delete'], called_commands)