Add snapshot deletion test
This adds a new test to ensure that snapshots
can be deleted when a volume is cloned from them.
This test runs when the "volume_image_dep_tests" option
is enabled.
Depends-On: I8ffb0c1130b30a19f336a98a9efef05905786af2
Change-Id: I18827bba3bc2730cde37696292b00a286bc53ef3
Eric Harney
1 year, 11 months ago
| 13 | 13 | # under the License. |
| 14 | 14 | |
| 15 | 15 | from tempest.common import utils |
| 16 | from tempest.common import waiters | |
| 17 | from tempest import config | |
| 16 | 18 | from tempest.lib import decorators |
| 17 | 19 | |
| 20 | import testtools | |
| 21 | ||
| 18 | 22 | from cinder_tempest_plugin.scenario import manager |
| 23 | ||
| 24 | CONF = config.CONF | |
| 19 | 25 | |
| 20 | 26 | |
| 21 | 27 | class SnapshotDataIntegrityTests(manager.ScenarioTest): |
| 120 | 126 | |
| 121 | 127 | self.assertEqual(count_snap, i) |
| 122 | 128 | self.assertEqual(file_map[i], md5_file) |
| 129 | ||
| 130 | ||
| 131 | class SnapshotDependencyTests(manager.ScenarioTest): | |
| 132 | @testtools.skipUnless(CONF.volume_feature_enabled.volume_image_dep_tests, | |
| 133 | 'dependency tests not enabled') | |
| 134 | @decorators.idempotent_id('e7028f52-f6d4-479c-8809-6f6cf96cfe0f') | |
| 135 | @utils.services('image', 'volume') | |
| 136 | def test_snapshot_removal(self): | |
| 137 | volume_1 = self.create_volume() | |
| 138 | ||
| 139 | snapshot_1 = self.create_volume_snapshot(volume_1['id'], force=True) | |
| 140 | waiters.wait_for_volume_resource_status( | |
| 141 | self.snapshots_client, snapshot_1['id'], 'available') | |
| 142 | ||
| 143 | clone_kwargs = {'snapshot_id': snapshot_1['id'], | |
| 144 | 'size': volume_1['size']} | |
| 145 | volume_2 = self.volumes_client.create_volume(**clone_kwargs)['volume'] | |
| 146 | ||
| 147 | waiters.wait_for_volume_resource_status( | |
| 148 | self.volumes_client, volume_2['id'], 'available') | |
| 149 | volume_2 = self.volumes_client.show_volume(volume_2['id'])['volume'] | |
| 150 | ||
| 151 | self.snapshots_client.delete_snapshot(snapshot_1['id']) | |
| 152 | self.snapshots_client.wait_for_resource_deletion(snapshot_1['id']) | |
| 153 | ||
| 154 | self.volumes_client.delete_volume(volume_1['id']) | |
| 155 | self.volumes_client.wait_for_resource_deletion(volume_1['id']) | |
| 156 | ||
| 157 | self.volumes_client.delete_volume(volume_2['id']) | |
| 158 | self.volumes_client.wait_for_resource_deletion(volume_2['id']) | |