From d29f9e34555c2af2d996cd96e084af4be513a33b Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Thu, 10 Nov 2011 21:54:14 -0500 Subject: Converting snapshot/backup to use instance objects Related to blueprint internal-uuids Change-Id: I8d9768524d36f7066cc1550bba01326dc5167a8d --- nova/tests/test_compute.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index 0e8d53751..666782105 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -1188,32 +1188,48 @@ class ComputeAPITestCase(BaseTestCase): self.compute.terminate_instance(self.context, instance_id) - def test_snapshot_conflict_backup(self): + def test_snapshot(self): + """Can't backup an instance which is already being backed up.""" + instance_id = self._create_instance() + instance = self.compute_api.get(self.context, instance_id) + self.compute_api.snapshot(self.context, instance, None, None) + db.instance_destroy(self.context, instance_id) + + def test_backup(self): + """Can't backup an instance which is already being backed up.""" + instance_id = self._create_instance() + instance = self.compute_api.get(self.context, instance_id) + self.compute_api.backup(self.context, instance, None, None, None) + db.instance_destroy(self.context, instance_id) + + def test_backup_conflict(self): """Can't backup an instance which is already being backed up.""" instance_id = self._create_instance() instance_values = {'task_state': task_states.IMAGE_BACKUP} db.instance_update(self.context, instance_id, instance_values) + instance = self.compute_api.get(self.context, instance_id) self.assertRaises(exception.InstanceBackingUp, self.compute_api.backup, self.context, - instance_id, + instance, None, None, None) db.instance_destroy(self.context, instance_id) - def test_snapshot_conflict_snapshot(self): + def test_snapshot_conflict(self): """Can't snapshot an instance which is already being snapshotted.""" instance_id = self._create_instance() instance_values = {'task_state': task_states.IMAGE_SNAPSHOT} db.instance_update(self.context, instance_id, instance_values) + instance = self.compute_api.get(self.context, instance_id) self.assertRaises(exception.InstanceSnapshotting, self.compute_api.snapshot, self.context, - instance_id, + instance, None) db.instance_destroy(self.context, instance_id) -- cgit