| 1 |
# Copyright 2014 NEC Corporation. All rights reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 |
# not use this file except in compliance with the License. You may obtain |
| 5 |
# a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 |
# License for the specific language governing permissions and limitations |
| 13 |
# under the License. |
| 14 |
|
| 15 |
from tempest import config |
| 16 |
from tempest.lib import decorators |
| 17 |
|
| 18 |
from ironic_tempest_plugin.tests.api.admin import api_microversion_fixture |
| 19 |
from ironic_tempest_plugin.tests.api import base |
| 20 |
|
| 21 |
CONF = config.CONF |
| 22 |
|
| 23 |
|
| 24 |
class TestDrivers(base.BaseBaremetalTest): |
| 25 |
"""Tests for drivers.""" |
| 26 |
|
| 27 |
@classmethod |
| 28 |
def resource_setup(cls): |
| 29 |
super(TestDrivers, cls).resource_setup() |
| 30 |
cls.driver_name = CONF.baremetal.driver |
| 31 |
|
| 32 |
@decorators.idempotent_id('5aed2790-7592-4655-9b16-99abcc2e6ec5') |
| 33 |
def test_list_drivers(self): |
| 34 |
_, drivers = self.client.list_drivers() |
| 35 |
self.assertIn(self.driver_name, |
| 36 |
[d['name'] for d in drivers['drivers']]) |
| 37 |
|
| 38 |
@decorators.idempotent_id('fb3287a3-c4d7-44bf-ae9d-1eef906d78ce') |
| 39 |
def test_show_driver(self): |
| 40 |
_, driver = self.client.show_driver(self.driver_name) |
| 41 |
self.assertEqual(self.driver_name, driver['name']) |
| 42 |
|
| 43 |
@decorators.idempotent_id('6efa976f-78a2-4859-b3aa-97d960d6e5e5') |
| 44 |
def test_driver_properties(self): |
| 45 |
_, properties = self.client.get_driver_properties(self.driver_name) |
| 46 |
self.assertNotEmpty(properties) |
| 47 |
|
| 48 |
@decorators.idempotent_id('fdf61f5a-f59d-4235-ad6c-cc718740e3e3') |
| 49 |
def test_driver_logical_disk_properties(self): |
| 50 |
self.useFixture( |
| 51 |
api_microversion_fixture.APIMicroversionFixture('1.12')) |
| 52 |
_, properties = self.client.get_driver_logical_disk_properties( |
| 53 |
self.driver_name) |
| 54 |
self.assertNotEmpty(properties) |