blob: b604360d0221a1fa6fbbac09aebfb8aa2864bdfc [file] [log] [blame]
wanghao1850c5f2013-10-08 11:51:29 +08001# 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
13import uuid
14
Masayuki Igawabfa07602015-01-20 18:47:17 +090015from tempest_lib import exceptions as lib_exc
16
wanghao1850c5f2013-10-08 11:51:29 +080017from tempest.api.volume import base
Fei Long Wangd39431f2015-05-14 11:30:48 +120018from tempest.common.utils import data_utils
JordanPbce55532014-03-19 12:10:32 +010019from tempest import config
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090020from tempest import test
wanghao1850c5f2013-10-08 11:51:29 +080021
JordanPbce55532014-03-19 12:10:32 +010022CONF = config.CONF
23
wanghao1850c5f2013-10-08 11:51:29 +080024
Zhi Kun Liu38641c62014-07-10 20:12:48 +080025class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest):
wanghao1850c5f2013-10-08 11:51:29 +080026
JordanPbce55532014-03-19 12:10:32 +010027 @classmethod
Rohan Kanade05749152015-01-30 17:15:18 +053028 def skip_checks(cls):
29 super(VolumesV2SnapshotNegativeTestJSON, cls).skip_checks()
JordanPbce55532014-03-19 12:10:32 +010030 if not CONF.volume_feature_enabled.snapshot:
31 raise cls.skipException("Cinder volume snapshots are disabled")
32
Sean Dague639f2fa2015-04-27 09:00:33 -040033 @test.attr(type=['negative'])
Chris Hoge7579c1a2015-02-26 14:12:15 -080034 @test.idempotent_id('e3e466af-70ab-4f4b-a967-ab04e3532ea7')
wanghao1850c5f2013-10-08 11:51:29 +080035 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 Igawabfa07602015-01-20 18:47:17 +090038 self.assertRaises(lib_exc.NotFound,
wanghao1850c5f2013-10-08 11:51:29 +080039 self.snapshots_client.create_snapshot,
40 str(uuid.uuid4()), display_name=s_name)
41
Sean Dague639f2fa2015-04-27 09:00:33 -040042 @test.attr(type=['negative'])
Chris Hoge7579c1a2015-02-26 14:12:15 -080043 @test.idempotent_id('bb9da53e-d335-4309-9c15-7e76fd5e4d6d')
wanghao1850c5f2013-10-08 11:51:29 +080044 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 Igawabfa07602015-01-20 18:47:17 +090047 self.assertRaises(lib_exc.NotFound,
wanghao1850c5f2013-10-08 11:51:29 +080048 self.snapshots_client.create_snapshot,
49 None, display_name=s_name)
50
51
Zhi Kun Liu38641c62014-07-10 20:12:48 +080052class VolumesV1SnapshotNegativeTestJSON(VolumesV2SnapshotNegativeTestJSON):
53 _api_version = 1