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
Erlon R. Cruz
7 years ago
| 15 | 15 | from tempest.common import waiters |
| 16 | 16 | from tempest import config |
| 17 | 17 | from tempest.lib import decorators |
| 18 | from tempest.lib import exceptions | |
| 18 | 19 | |
| 19 | 20 | from cinder_tempest_plugin.api.volume import base |
| 20 | 21 | from cinder_tempest_plugin import cinder_clients |
| 64 | 65 | self.assertEqual(expected_size, volume['size']) |
| 65 | 66 | |
| 66 | 67 | @decorators.idempotent_id('4e8b0788-87fe-430d-be7a-444d7f8e0347') |
| 67 | def test_volume_revert_to_snapshot_after_extended(self): | |
| 68 | def test_volume_revert_to_snapshot_after_extended_negative(self): | |
| 68 | 69 | """Test revert to snapshot after extended""" |
| 69 | 70 | # Extend volume to double the size |
| 70 | 71 | expected_size = self.volume['size'] * 2 |
| 73 | 74 | new_size=expected_size) |
| 74 | 75 | waiters.wait_for_volume_resource_status(self.volumes_client, |
| 75 | 76 | self.volume['id'], 'available') |
| 76 | # Revert to snapshot | |
| 77 | self.volume_revert_client.revert_to_snapshot(self.volume, | |
| 78 | self.snapshot['id']) | |
| 79 | waiters.wait_for_volume_resource_status( | |
| 80 | self.volumes_client, | |
| 81 | self.volume['id'], 'available') | |
| 82 | waiters.wait_for_volume_resource_status( | |
| 83 | self.snapshots_client, | |
| 84 | self.snapshot['id'], 'available') | |
| 85 | volume = self.volumes_client.show_volume(self.volume['id'])['volume'] | |
| 86 | self.assertEqual(expected_size, volume['size']) | |
| 77 | ||
| 78 | # Destination volume smaller than source, API should block that | |
| 79 | self.assertRaises(exceptions.BadRequest, | |
| 80 | self.volume_revert_client.revert_to_snapshot, | |
| 81 | self.volume, self.snapshot) | |