diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-12-11 17:58:16 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-12-11 17:58:16 +0000 |
| commit | 5a2f8cbe52d4ec07ccf9867d567b217cdb4d11c2 (patch) | |
| tree | 50ece40116d4bfc84207c7f88b437ebdeed7009f /nova/tests | |
| parent | 0111ac1dd1deb76187a13e32e20765c7bcc54bc6 (diff) | |
| parent | eed626753c23bb82453bc5176193831fbb9e538c (diff) | |
Merge "Map cinder snapshot statuses to ec2."
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/ec2/test_cinder_cloud.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/nova/tests/api/ec2/test_cinder_cloud.py b/nova/tests/api/ec2/test_cinder_cloud.py index e0d9aa8a8..3c119a2c2 100644 --- a/nova/tests/api/ec2/test_cinder_cloud.py +++ b/nova/tests/api/ec2/test_cinder_cloud.py @@ -19,6 +19,7 @@ import copy import tempfile +import uuid from nova.api.ec2 import cloud from nova.api.ec2 import ec2utils @@ -257,6 +258,54 @@ class CinderCloudTestCase(test.TestCase): self.cloud.delete_snapshot(self.context, snap2['snapshotId']) self.cloud.delete_volume(self.context, vol1['volumeId']) + def test_format_snapshot_maps_status(self): + fake_snapshot = {'status': 'new', + 'id': 1, + 'volume_id': 1, + 'created_at': 1353560191.08117, + 'progress': 90, + 'project_id': str(uuid.uuid4()), + 'volume_size': 10000, + 'display_description': 'desc'} + + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot)['status'], + 'pending') + + fake_snapshot['status'] = 'creating' + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot)['status'], + 'pending') + + fake_snapshot['status'] = 'available' + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot)['status'], + 'completed') + + fake_snapshot['status'] = 'active' + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot)['status'], + 'completed') + + fake_snapshot['status'] = 'deleting' + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot)['status'], + 'pending') + + fake_snapshot['status'] = 'deleted' + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot), None) + + fake_snapshot['status'] = 'error' + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot)['status'], + 'error') + + fake_snapshot['status'] = 'banana' + self.assertEqual(self.cloud._format_snapshot(self.context, + fake_snapshot)['status'], + 'banana') + def test_create_snapshot(self): """Makes sure create_snapshot works.""" availability_zone = 'zone1:host1' |
