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 | |
Masayuki Igawa | bfa0760 | 2015-01-20 18:47:17 +0900 | [diff] [blame] | 15 | from tempest_lib import exceptions as lib_exc |
| 16 | |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 17 | from tempest.api.volume import base |
Fei Long Wang | d39431f | 2015-05-14 11:30:48 +1200 | [diff] [blame] | 18 | from tempest.common.utils import data_utils |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 19 | from tempest import config |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 20 | from tempest import test |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 21 | |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 22 | CONF = config.CONF |
| 23 | |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 24 | |
Zhi Kun Liu | 38641c6 | 2014-07-10 20:12:48 +0800 | [diff] [blame] | 25 | class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest): |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 26 | |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 27 | @classmethod |
Rohan Kanade | 0574915 | 2015-01-30 17:15:18 +0530 | [diff] [blame] | 28 | def skip_checks(cls): |
| 29 | super(VolumesV2SnapshotNegativeTestJSON, cls).skip_checks() |
JordanP | bce5553 | 2014-03-19 12:10:32 +0100 | [diff] [blame] | 30 | if not CONF.volume_feature_enabled.snapshot: |
| 31 | raise cls.skipException("Cinder volume snapshots are disabled") |
| 32 | |
Sean Dague | 639f2fa | 2015-04-27 09:00:33 -0400 | [diff] [blame] | 33 | @test.attr(type=['negative']) |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 34 | @test.idempotent_id('e3e466af-70ab-4f4b-a967-ab04e3532ea7') |
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') |
Masayuki Igawa | bfa0760 | 2015-01-20 18:47:17 +0900 | [diff] [blame] | 38 | self.assertRaises(lib_exc.NotFound, |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 39 | self.snapshots_client.create_snapshot, |
| 40 | str(uuid.uuid4()), display_name=s_name) |
| 41 | |
Sean Dague | 639f2fa | 2015-04-27 09:00:33 -0400 | [diff] [blame] | 42 | @test.attr(type=['negative']) |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 43 | @test.idempotent_id('bb9da53e-d335-4309-9c15-7e76fd5e4d6d') |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 44 | def test_create_snapshot_without_passing_volume_id(self): |
| 45 | # Create a snapshot without passing volume id |
| 46 | s_name = data_utils.rand_name('snap') |
Masayuki Igawa | bfa0760 | 2015-01-20 18:47:17 +0900 | [diff] [blame] | 47 | self.assertRaises(lib_exc.NotFound, |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 48 | self.snapshots_client.create_snapshot, |
| 49 | None, display_name=s_name) |
| 50 | |
| 51 | |
Zhi Kun Liu | 38641c6 | 2014-07-10 20:12:48 +0800 | [diff] [blame] | 52 | class VolumesV1SnapshotNegativeTestJSON(VolumesV2SnapshotNegativeTestJSON): |
| 53 | _api_version = 1 |