blob: 2d7b6dec080652ca68059b5324202bb4a8cdaa35 [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 Liu38641c62014-07-10 20:12:48 +080024class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest):
wanghao1850c5f2013-10-08 11:51:29 +080025
JordanPbce55532014-03-19 12:10:32 +010026 @classmethod
Andrea Frittoli61a12e22014-09-15 13:14:54 +010027 def resource_setup(cls):
28 super(VolumesV2SnapshotNegativeTestJSON, cls).resource_setup()
JordanPbce55532014-03-19 12:10:32 +010029
30 if not CONF.volume_feature_enabled.snapshot:
31 raise cls.skipException("Cinder volume snapshots are disabled")
32
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090033 @test.attr(type=['negative', 'gate'])
wanghao1850c5f2013-10-08 11:51:29 +080034 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 Igawa1edf94f2014-03-04 18:34:16 +090041 @test.attr(type=['negative', 'gate'])
wanghao1850c5f2013-10-08 11:51:29 +080042 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 Liu38641c62014-07-10 20:12:48 +080050class VolumesV1SnapshotNegativeTestJSON(VolumesV2SnapshotNegativeTestJSON):
51 _api_version = 1