Fix volume revert to snapshot tests

According to the revert to snapshot spec, it should not be
possible to revert a volume to a snapshot after the volume is
extended. This was fixed on [1] but the cinder_tempest_plugin
test still was being considering the old behavior.

[1] https://bugs.launchpad.net/cinder/+bug/1798503

Change-Id: I21d0b2291608922e46278ae5799478a5df0c4904
This commit is contained in:
Erlon R. Cruz 2018-11-05 17:44:21 -02:00
parent d12f0b693e
commit f208601ab5
1 changed files with 7 additions and 12 deletions

View File

@ -16,6 +16,7 @@
from tempest.common import waiters
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions
from cinder_tempest_plugin.api.volume import base
from cinder_tempest_plugin import cinder_clients
@ -65,7 +66,7 @@ class VolumeRevertTests(base.BaseVolumeTest):
self.assertEqual(expected_size, volume['size'])
@decorators.idempotent_id('4e8b0788-87fe-430d-be7a-444d7f8e0347')
def test_volume_revert_to_snapshot_after_extended(self):
def test_volume_revert_to_snapshot_after_extended_negative(self):
"""Test revert to snapshot after extended"""
# Extend volume to double the size
expected_size = self.volume['size'] * 2
@ -74,14 +75,8 @@ class VolumeRevertTests(base.BaseVolumeTest):
new_size=expected_size)
waiters.wait_for_volume_resource_status(self.volumes_client,
self.volume['id'], 'available')
# Revert to snapshot
self.volume_revert_client.revert_to_snapshot(self.volume,
self.snapshot['id'])
waiters.wait_for_volume_resource_status(
self.volumes_client,
self.volume['id'], 'available')
waiters.wait_for_volume_resource_status(
self.snapshots_client,
self.snapshot['id'], 'available')
volume = self.volumes_client.show_volume(self.volume['id'])['volume']
self.assertEqual(expected_size, volume['size'])
# Destination volume smaller than source, API should block that
self.assertRaises(exceptions.BadRequest,
self.volume_revert_client.revert_to_snapshot,
self.volume, self.snapshot)