Add case: volume can't be reverted in in-use status

This patch add test case: volume can't be reverted to snapshot in
in-use status.

Change-Id: I9047876ee8225cdd21acddd8a05db5cbab3d3365
This commit is contained in:
caixiaoyu 2019-06-20 10:54:51 +08:00
parent 4f4de3bfe3
commit ef89161e20
1 changed files with 14 additions and 0 deletions

View File

@ -2118,6 +2118,20 @@ class VolumeTestCase(base.BaseVolumeTestCase):
self.assertEqual('available', fake_snapshot['status'])
self.assertEqual(2, fake_volume['size'])
def test_cannot_revert_to_snapshot_in_use(self):
"""Test volume can't be reverted to snapshot in in-use status."""
fake_volume = tests_utils.create_volume(self.context,
status='in-use')
fake_snapshot = tests_utils.create_snapshot(self.context,
fake_volume.id,
status='available')
self.assertRaises(exception.InvalidVolume,
self.volume_api.revert_to_snapshot,
self.context,
fake_volume,
fake_snapshot)
def test_cannot_delete_volume_with_snapshots(self):
"""Test volume can't be deleted with dependent snapshots."""
volume = tests_utils.create_volume(self.context, **self.volume_params)