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 | bb363a2 | 2013-11-28 18:47:39 +0800 | [diff] [blame] | 24 | class VolumesSnapshotNegativeTest(base.BaseVolumeV1Test): |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 25 | _interface = "json" |
| 26 | |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame^] | 27 | @classmethod |
| 28 | def setUpClass(cls): |
| 29 | super(VolumesSnapshotNegativeTest, cls).setUpClass() |
| 30 | |
| 31 | if not CONF.volume_feature_enabled.snapshot: |
| 32 | raise cls.skipException("Cinder volume snapshots are disabled") |
| 33 | |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 34 | @test.attr(type=['negative', 'gate']) |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 35 | def test_create_snapshot_with_nonexistent_volume_id(self): |
| 36 | # Create a snapshot with nonexistent volume id |
| 37 | s_name = data_utils.rand_name('snap') |
| 38 | self.assertRaises(exceptions.NotFound, |
| 39 | self.snapshots_client.create_snapshot, |
| 40 | str(uuid.uuid4()), display_name=s_name) |
| 41 | |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 42 | @test.attr(type=['negative', 'gate']) |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 43 | def test_create_snapshot_without_passing_volume_id(self): |
| 44 | # Create a snapshot without passing volume id |
| 45 | s_name = data_utils.rand_name('snap') |
| 46 | self.assertRaises(exceptions.NotFound, |
| 47 | self.snapshots_client.create_snapshot, |
| 48 | None, display_name=s_name) |
| 49 | |
| 50 | |
| 51 | class VolumesSnapshotNegativeTestXML(VolumesSnapshotNegativeTest): |
| 52 | _interface = "xml" |