Codebase list cinder-tempest-plugin / ec1b30b
Merge "Deleting volumes which are consumed as a basis for others" Zuul authored 2 years ago Gerrit Code Review committed 2 years ago
1 changed file(s) with 65 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 # Copyright 2022 Red Hat, Inc.
1 # All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 from tempest import config
16 from tempest.lib import decorators
17
18 from cinder_tempest_plugin.api.volume import base
19
20 CONF = config.CONF
21
22
23 class VolumeDependencyTests(base.BaseVolumeTest):
24 min_microversion = '3.40'
25
26 @classmethod
27 def setup_clients(cls):
28 super(VolumeDependencyTests, cls).setup_clients()
29
30 @decorators.idempotent_id('42e9df95-854b-4840-9d55-ae62f65e9b8e')
31 def test_delete_source_volume(self):
32 """Test basic dependency deletion
33
34 * Create a volume with source_volid
35 * Delete the source volume
36 """
37 source_volume = self.create_volume()
38 kwargs = {'source_volid': source_volume['id']}
39 cloned_volume = self.create_volume(**kwargs)
40 self.assertEqual(source_volume['id'], cloned_volume['source_volid'])
41 self.volumes_client.delete_volume(source_volume['id'])
42 self.volumes_client.wait_for_resource_deletion(source_volume['id'])
43
44 @decorators.idempotent_id('900d8ea5-2afd-4fe5-a0c3-fab4744f0d40')
45 def test_delete_source_snapshot(self):
46 """Test basic dependency deletion with snapshot
47
48 * Create a snapshot from source volume
49 * Create a volume from that snapshot
50 * Delete the source snapshot
51 * Delete the source volume
52 """
53 source_volume = self.create_volume()
54 snapshot_source_volume = self.create_snapshot(source_volume['id'])
55 kwargs = {'snapshot_id': snapshot_source_volume['id']}
56 volume_from_snapshot = self.create_volume(**kwargs)
57 self.assertEqual(volume_from_snapshot['snapshot_id'],
58 snapshot_source_volume['id'])
59
60 self.snapshots_client.delete_snapshot(snapshot_source_volume['id'])
61 self.snapshots_client.wait_for_resource_deletion(
62 snapshot_source_volume['id'])
63 self.volumes_client.delete_volume(source_volume['id'])
64 self.volumes_client.wait_for_resource_deletion(source_volume['id'])