Andrew Kerr | fcb0b68 | 2016-04-01 16:01:34 -0400 | [diff] [blame] | 1 | # Copyright 2016 Andrew Kerr |
| 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 | from tempest.api.volume import api_microversion_fixture |
| 16 | from tempest.api.volume import base |
| 17 | from tempest import config |
| 18 | from tempest.lib.common import api_version_utils |
| 19 | |
| 20 | CONF = config.CONF |
| 21 | |
| 22 | |
| 23 | class VolumesV3Test(api_version_utils.BaseMicroversionTest, |
| 24 | base.BaseVolumeTest): |
| 25 | """Base test case class for all v3 Cinder API tests.""" |
| 26 | |
| 27 | _api_version = 3 |
| 28 | |
| 29 | @classmethod |
| 30 | def skip_checks(cls): |
| 31 | super(VolumesV3Test, cls).skip_checks() |
| 32 | api_version_utils.check_skip_with_microversion( |
| 33 | cls.min_microversion, cls.max_microversion, |
| 34 | CONF.volume.min_microversion, CONF.volume.max_microversion) |
| 35 | |
| 36 | @classmethod |
| 37 | def resource_setup(cls): |
| 38 | super(VolumesV3Test, cls).resource_setup() |
| 39 | cls.request_microversion = ( |
| 40 | api_version_utils.select_request_microversion( |
| 41 | cls.min_microversion, |
| 42 | CONF.volume.min_microversion)) |
| 43 | |
| 44 | @classmethod |
| 45 | def setup_clients(cls): |
| 46 | super(VolumesV3Test, cls).setup_clients() |
| 47 | cls.messages_client = cls.os.volume_messages_client |
| 48 | |
| 49 | def setUp(self): |
| 50 | super(VolumesV3Test, self).setUp() |
| 51 | self.useFixture(api_microversion_fixture.APIMicroversionFixture( |
| 52 | self.request_microversion)) |
| 53 | |
| 54 | |
| 55 | class VolumesV3AdminTest(VolumesV3Test): |
| 56 | """Base test case class for all v3 Volume Admin API tests.""" |
| 57 | |
| 58 | credentials = ['primary', 'admin'] |
| 59 | |
| 60 | @classmethod |
| 61 | def setup_clients(cls): |
| 62 | super(VolumesV3AdminTest, cls).setup_clients() |
| 63 | cls.admin_messages_client = cls.os_adm.volume_messages_client |
| 64 | cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client |