blob: 61aa307c4bcac1fae996ee16e1a5b94617f71dfd [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
15from tempest.api.volume import base
16from tempest.common.utils import data_utils
JordanPbce55532014-03-19 12:10:32 +010017from tempest import config
wanghao1850c5f2013-10-08 11:51:29 +080018from tempest import exceptions
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090019from tempest import test
wanghao1850c5f2013-10-08 11:51:29 +080020
JordanPbce55532014-03-19 12:10:32 +010021CONF = config.CONF
22
wanghao1850c5f2013-10-08 11:51:29 +080023
Zhi Kun Liubb363a22013-11-28 18:47:39 +080024class VolumesSnapshotNegativeTest(base.BaseVolumeV1Test):
wanghao1850c5f2013-10-08 11:51:29 +080025 _interface = "json"
26
JordanPbce55532014-03-19 12:10:32 +010027 @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 Igawa1edf94f2014-03-04 18:34:16 +090034 @test.attr(type=['negative', 'gate'])
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')
38 self.assertRaises(exceptions.NotFound,
39 self.snapshots_client.create_snapshot,
40 str(uuid.uuid4()), display_name=s_name)
41
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090042 @test.attr(type=['negative', 'gate'])
wanghao1850c5f2013-10-08 11:51:29 +080043 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
51class VolumesSnapshotNegativeTestXML(VolumesSnapshotNegativeTest):
52 _interface = "xml"