summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-11-11 19:06:18 +0000
committerGerrit Code Review <review@openstack.org>2011-11-11 19:06:18 +0000
commit314539cce77846a7fe9ff7dc52d6291fcc34814e (patch)
treecd565c0122bbfed8cedffbd2d6b4918bdc10a1a8 /nova/tests
parented3635f40fa31b896bb700610b93fe288a90e692 (diff)
parentd29f9e34555c2af2d996cd96e084af4be513a33b (diff)
Merge "Converting snapshot/backup to use instance objects"
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 20a8e3d5b..2bf726697 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -1190,32 +1190,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)