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 |
Michał Dulko | ad3c2d8 | 2017-02-02 13:41:28 +0100 | [diff] [blame] | 17 | from tempest import config |
Ken'ichi Ohmichi | 6b279c7 | 2017-01-27 18:26:59 -0800 | [diff] [blame] | 18 | from tempest.lib import decorators |
bkopilov | 1f161e5 | 2016-04-18 13:27:48 +0300 | [diff] [blame] | 19 | |
Michał Dulko | ad3c2d8 | 2017-02-02 13:41:28 +0100 | [diff] [blame] | 20 | CONF = config.CONF |
| 21 | |
bkopilov | 1f161e5 | 2016-04-18 13:27:48 +0300 | [diff] [blame] | 22 | |
Ken'ichi Ohmichi | e8afb8c | 2017-03-27 11:25:37 -0700 | [diff] [blame] | 23 | class VolumePoolsAdminTestsJSON(base.BaseVolumeAdminTest): |
Michał Dulko | ad3c2d8 | 2017-02-02 13:41:28 +0100 | [diff] [blame] | 24 | def _assert_pools(self, with_detail=False): |
Masayuki Igawa | 2b96098 | 2017-06-05 11:16:59 +0900 | [diff] [blame] | 25 | cinder_pools = self.admin_scheduler_stats_client.list_pools( |
lkuchlan | 1df8033 | 2016-11-30 16:24:27 +0200 | [diff] [blame] | 26 | detail=with_detail)['pools'] |
zhufl | f045a52 | 2019-09-20 17:03:31 +0800 | [diff] [blame] | 27 | self.assertNotEmpty(cinder_pools, "no cinder pools listed.") |
Michał Dulko | ad3c2d8 | 2017-02-02 13:41:28 +0100 | [diff] [blame] | 28 | self.assertIn('name', cinder_pools[0]) |
| 29 | if with_detail: |
| 30 | self.assertIn(CONF.volume.vendor_name, |
| 31 | [pool['capabilities']['vendor_name'] |
| 32 | for pool in cinder_pools]) |
bkopilov | 1f161e5 | 2016-04-18 13:27:48 +0300 | [diff] [blame] | 33 | |
Ken'ichi Ohmichi | 6b279c7 | 2017-01-27 18:26:59 -0800 | [diff] [blame] | 34 | @decorators.idempotent_id('0248a46c-e226-4933-be10-ad6fca8227e7') |
lkuchlan | 1df8033 | 2016-11-30 16:24:27 +0200 | [diff] [blame] | 35 | def test_get_pools_without_details(self): |
Michał Dulko | ad3c2d8 | 2017-02-02 13:41:28 +0100 | [diff] [blame] | 36 | self._assert_pools() |
lkuchlan | 1df8033 | 2016-11-30 16:24:27 +0200 | [diff] [blame] | 37 | |
Ken'ichi Ohmichi | 6b279c7 | 2017-01-27 18:26:59 -0800 | [diff] [blame] | 38 | @decorators.idempotent_id('d4bb61f7-762d-4437-b8a4-5785759a0ced') |
bkopilov | 1f161e5 | 2016-04-18 13:27:48 +0300 | [diff] [blame] | 39 | def test_get_pools_with_details(self): |
Michał Dulko | ad3c2d8 | 2017-02-02 13:41:28 +0100 | [diff] [blame] | 40 | self._assert_pools(with_detail=True) |