summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-11-10 21:54:14 -0500
committerBrian Waldon <brian.waldon@rackspace.com>2011-11-10 21:54:14 -0500
commitd29f9e34555c2af2d996cd96e084af4be513a33b (patch)
tree278e0f0c5ba4f660f3238fb33b233574a56dd2be /nova/tests
parent59dfaf9e02ff0064a6844c9c986737267317776f (diff)
Converting snapshot/backup to use instance objects
Related to blueprint internal-uuids Change-Id: I8d9768524d36f7066cc1550bba01326dc5167a8d
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_compute.py24
1 files changed, 20 insertions, 4 deletions
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)