Add tempest plugin API tests for driver

Test for the following actions were added:

* getting driver's properties
* getting driver's RAID logical disk properties

Change-Id: I395bc4f512a731ab4bfe8ac6a2d850816696400f
This commit is contained in:
SofiiaAndriichenko 2016-12-08 05:02:17 -05:00
parent bb72f2e3fc
commit 569f0a4e71
3 changed files with 47 additions and 1 deletions

View File

@ -150,7 +150,11 @@ class BaremetalClient(rest_client.RestClient):
return resp, self.deserialize(body)
def _show_request(self, resource, uuid, permanent=False, **kwargs):
def _show_request(self,
resource,
uuid=None,
permanent=False,
**kwargs):
"""Gets a specific object of the specified type.
:param uuid: Unique identifier of the object in UUID format.

View File

@ -493,3 +493,30 @@ class BaremetalClient(base.BaremetalClient):
resp, body = self._delete_request('nodes/%s/vifs' % node_uuid, vif_id)
self.expected_success(http_client.NO_CONTENT, resp.status)
return resp, body
@base.handle_errors
def get_driver_properties(self, driver_name):
"""Get properties information about driver.
:param driver_name: Name of driver.
:return: tuple of response and serialized properties as a dictionary.
"""
uri = 'drivers/%s/properties' % driver_name
resp, body = self.get(uri)
self.expected_success(200, resp.status)
return resp, self.deserialize(body)
@base.handle_errors
def get_driver_logical_disk_properties(self, driver_name):
"""Get driver logical disk properties.
:param driver_name: Name of driver.
:return: tuple of response and serialized logical disk properties as
a dictionary.
"""
uri = 'drivers/%s/raid/logical_disk_properties' % driver_name
resp, body = self.get(uri)
self.expected_success(200, resp.status)
return resp, self.deserialize(body)

View File

@ -15,6 +15,7 @@
from tempest import config
from tempest.lib import decorators
from ironic_tempest_plugin.tests.api.admin import api_microversion_fixture
from ironic_tempest_plugin.tests.api.admin import base
CONF = config.CONF
@ -22,6 +23,7 @@ CONF = config.CONF
class TestDrivers(base.BaseBaremetalTest):
"""Tests for drivers."""
@classmethod
def resource_setup(cls):
super(TestDrivers, cls).resource_setup()
@ -37,3 +39,16 @@ class TestDrivers(base.BaseBaremetalTest):
def test_show_driver(self):
_, driver = self.client.show_driver(self.driver_name)
self.assertEqual(self.driver_name, driver['name'])
@decorators.idempotent_id('6efa976f-78a2-4859-b3aa-97d960d6e5e5')
def test_driver_properties(self):
_, properties = self.client.get_driver_properties(self.driver_name)
self.assertNotEmpty(properties)
@decorators.idempotent_id('fdf61f5a-f59d-4235-ad6c-cc718740e3e3')
def test_driver_logical_disk_properties(self):
self.useFixture(
api_microversion_fixture.APIMicroversionFixture('1.12'))
_, properties = self.client.get_driver_logical_disk_properties(
self.driver_name)
self.assertNotEmpty(properties)