Codebase list cinder-tempest-plugin / 91cdf7a
Merge "tempest: Add Unicode volume name test" Jenkins authored 9 years ago Gerrit Code Review committed 9 years ago
1 changed file(s) with 59 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 # -*- coding: utf-8 -*-
1 # Copyright 2016 Red Hat, Inc.
2 # All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 from tempest.api.volume import base as volume_base
17 from tempest.common.utils import data_utils
18 from tempest.common import waiters
19 from tempest import config
20
21 CONF = config.CONF
22
23
24 class CinderUnicodeTest(volume_base.BaseVolumeTest):
25
26 @classmethod
27 def resource_setup(cls):
28 super(CinderUnicodeTest, cls).resource_setup()
29
30 # Stick to three-byte unicode here, since four+ byte
31 # chars require utf8mb4 database support which may not
32 # be configured.
33 cls.volume_name = u"CinderUnicodeTest塵㼗‽"
34 cls.volume = cls.create_volume_with_args(name=cls.volume_name)
35
36 @classmethod
37 def create_volume_with_args(cls, **kwargs):
38 name = kwargs['name'] or data_utils.rand_name('Volume')
39
40 name_field = cls.special_fields['name_field']
41 kwargs[name_field] = name
42
43 volume = cls.volumes_client.create_volume(**kwargs)['volume']
44 cls.volumes.append(volume)
45
46 waiters.wait_for_volume_status(cls.volumes_client,
47 volume['id'],
48 'available')
49
50 return volume
51
52 def test_create_delete_unicode_volume_name(self):
53 """Create a volume with a unicode name and view it."""
54
55 result = self.volumes_client.show_volume(self.volumes[0]['id'])
56 fetched_volume = result['volume']
57 self.assertEqual(fetched_volume[self.special_fields['name_field']],
58 self.volume_name)