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
diff --git a/ironic_tempest_plugin/services/baremetal/base.py b/ironic_tempest_plugin/services/baremetal/base.py
index bb9ba9e..757a770 100644
--- a/ironic_tempest_plugin/services/baremetal/base.py
+++ b/ironic_tempest_plugin/services/baremetal/base.py
@@ -150,7 +150,11 @@
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.
diff --git a/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py b/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py
index 0a35a3d..749403f 100644
--- a/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py
+++ b/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py
@@ -493,3 +493,30 @@
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)
diff --git a/ironic_tempest_plugin/tests/api/admin/test_drivers.py b/ironic_tempest_plugin/tests/api/admin/test_drivers.py
index c3d1973..e80a963 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_drivers.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_drivers.py
@@ -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 @@
class TestDrivers(base.BaseBaremetalTest):
"""Tests for drivers."""
+
@classmethod
def resource_setup(cls):
super(TestDrivers, cls).resource_setup()
@@ -37,3 +39,16 @@
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)