blob: 75ea1559876ef6e29708cdf98b17ecf2317fa98b [file] [log] [blame]
Attila Fazekas36b1fcf2013-01-31 16:41:04 +01001# vim: tabstop=4 shiftwidth=4 softtabstop=4
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
Attila Fazekas36b1fcf2013-01-31 16:41:04 +010015from tempest.common.utils.data_utils import rand_name
16from tempest.tests.volume import base
17
18
19class VolumesSnapshotTestBase(object):
20
21 def test_volume_from_snapshot(self):
22 volume_origin = self.create_volume(size=1)
23 snapshot = self.create_snapshot(volume_origin['id'])
24 volume_snap = self.create_volume(size=1,
25 snapshot_id=
26 snapshot['id'])
27 self.snapshots_client.delete_snapshot(snapshot['id'])
28 self.client.delete_volume(volume_snap['id'])
29 self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
30 self.snapshots.remove(snapshot)
31 self.client.delete_volume(volume_origin['id'])
32 self.client.wait_for_resource_deletion(volume_snap['id'])
33 self.volumes.remove(volume_snap)
34 self.client.wait_for_resource_deletion(volume_origin['id'])
35 self.volumes.remove(volume_origin)
36
37
38class VolumesSnapshotTestXML(base.BaseVolumeTestXML,
39 VolumesSnapshotTestBase):
40 @classmethod
41 def setUpClass(cls):
42 cls._interface = "xml"
43 super(VolumesSnapshotTestXML, cls).setUpClass()
44 cls.client = cls.volumes_client
45
46
47class VolumesSnapshotTestJSON(base.BaseVolumeTestJSON,
48 VolumesSnapshotTestBase):
49 @classmethod
50 def setUpClass(cls):
51 cls._interface = "json"
52 super(VolumesSnapshotTestJSON, cls).setUpClass()
53 cls.client = cls.volumes_client