bkopilov | 1f161e5 | 2016-04-18 13:27:48 +0300 | [diff] [blame] | 1 | # Copyright 2016 OpenStack Foundation |
| 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 |
| 17 | from tempest import test |
| 18 | |
| 19 | |
| 20 | class VolumePoolsAdminV2TestsJSON(base.BaseVolumeAdminTest): |
| 21 | |
| 22 | @classmethod |
| 23 | def resource_setup(cls): |
| 24 | super(VolumePoolsAdminV2TestsJSON, cls).resource_setup() |
| 25 | # Create a test shared volume for tests |
| 26 | cls.volume = cls.create_volume() |
| 27 | |
| 28 | @test.idempotent_id('0248a46c-e226-4933-be10-ad6fca8227e7') |
| 29 | def test_get_pools_without_details(self): |
| 30 | volume_info = self.admin_volume_client. \ |
| 31 | show_volume(self.volume['id'])['volume'] |
| 32 | cinder_pools = self.admin_volume_client.show_pools()['pools'] |
| 33 | self.assertIn(volume_info['os-vol-host-attr:host'], |
| 34 | [pool['name'] for pool in cinder_pools]) |
| 35 | |
| 36 | @test.idempotent_id('d4bb61f7-762d-4437-b8a4-5785759a0ced') |
| 37 | def test_get_pools_with_details(self): |
| 38 | volume_info = self.admin_volume_client. \ |
| 39 | show_volume(self.volume['id'])['volume'] |
| 40 | cinder_pools = self.admin_volume_client.\ |
| 41 | show_pools(detail=True)['pools'] |
| 42 | self.assertIn(volume_info['os-vol-host-attr:host'], |
| 43 | [pool['name'] for pool in cinder_pools]) |