wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
| 13 | import uuid |
| 14 | |
| 15 | from tempest.api.volume import base |
| 16 | from tempest.common.utils import data_utils |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 17 | from tempest import config |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 18 | from tempest import exceptions |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 19 | from tempest import test |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 20 | |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 21 | CONF = config.CONF |
| 22 | |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 23 | |
Zhi Kun Liu | 38641c6 | 2014-07-10 20:12:48 +0800 | [diff] [blame] | 24 | class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest): |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 25 | |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 26 | @classmethod |
Andrea Frittoli | 61a12e2 | 2014-09-15 13:14:54 +0100 | [diff] [blame] | 27 | def resource_setup(cls): |
| 28 | super(VolumesV2SnapshotNegativeTestJSON, cls).resource_setup() |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 29 | |
| 30 | if not CONF.volume_feature_enabled.snapshot: |
| 31 | raise cls.skipException("Cinder volume snapshots are disabled") |
| 32 | |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 33 | @test.attr(type=['negative', 'gate']) |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 34 | def test_create_snapshot_with_nonexistent_volume_id(self): |
| 35 | # Create a snapshot with nonexistent volume id |
| 36 | s_name = data_utils.rand_name('snap') |
| 37 | self.assertRaises(exceptions.NotFound, |
| 38 | self.snapshots_client.create_snapshot, |
| 39 | str(uuid.uuid4()), display_name=s_name) |
| 40 | |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 41 | @test.attr(type=['negative', 'gate']) |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 42 | def test_create_snapshot_without_passing_volume_id(self): |
| 43 | # Create a snapshot without passing volume id |
| 44 | s_name = data_utils.rand_name('snap') |
| 45 | self.assertRaises(exceptions.NotFound, |
| 46 | self.snapshots_client.create_snapshot, |
| 47 | None, display_name=s_name) |
| 48 | |
| 49 | |
Zhi Kun Liu | 38641c6 | 2014-07-10 20:12:48 +0800 | [diff] [blame] | 50 | class VolumesV1SnapshotNegativeTestJSON(VolumesV2SnapshotNegativeTestJSON): |
| 51 | _api_version = 1 |