From 598f78382551f50b3bef8a79143d3761ce831422 Mon Sep 17 00:00:00 2001 From: SofiiaAndriichenko Date: Fri, 9 Dec 2016 10:12:18 -0500 Subject: [PATCH] This adds a tempest test for creating a chassis with a specific UUID. Change-Id: I51fbcd0613c16618d5e4a52ae1d798321a21bced --- .../services/baremetal/v1/json/baremetal_client.py | 3 +++ ironic_tempest_plugin/tests/api/admin/base.py | 5 +++-- ironic_tempest_plugin/tests/api/admin/test_chassis.py | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) 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 6d88e7c08e..dc4cdc15bd 100644 --- a/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py +++ b/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py @@ -157,6 +157,9 @@ class BaremetalClient(base.BaremetalClient): """ chassis = {'description': kwargs.get('description', 'test-chassis')} + if 'uuid' in kwargs: + chassis.update({'uuid': kwargs.get('uuid')}) + return self._create_request('chassis', chassis) @base.handle_errors diff --git a/ironic_tempest_plugin/tests/api/admin/base.py b/ironic_tempest_plugin/tests/api/admin/base.py index cd15936845..f6b634ca05 100644 --- a/ironic_tempest_plugin/tests/api/admin/base.py +++ b/ironic_tempest_plugin/tests/api/admin/base.py @@ -147,7 +147,7 @@ class BaseBaremetalTest(api_version_utils.BaseMicroversionTest, @classmethod @creates('chassis') - def create_chassis(cls, description=None): + def create_chassis(cls, description=None, **kwargs): """Wrapper utility for creating test chassis. :param description: A description of the chassis. If not supplied, @@ -156,7 +156,8 @@ class BaseBaremetalTest(api_version_utils.BaseMicroversionTest, """ description = description or data_utils.rand_name('test-chassis') - resp, body = cls.client.create_chassis(description=description) + resp, body = cls.client.create_chassis(description=description, + **kwargs) return resp, body @classmethod diff --git a/ironic_tempest_plugin/tests/api/admin/test_chassis.py b/ironic_tempest_plugin/tests/api/admin/test_chassis.py index 78912a25b2..19bdc136af 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_chassis.py +++ b/ironic_tempest_plugin/tests/api/admin/test_chassis.py @@ -75,3 +75,9 @@ class TestChassis(base.BaseBaremetalTest): _, node = self.create_node(self.chassis['uuid']) _, body = self.client.list_chassis_nodes(self.chassis['uuid']) self.assertIn(node['uuid'], [n['uuid'] for n in body['nodes']]) + + @decorators.idempotent_id('dd52bd5d-610c-4f2c-8fa3-d5e59269325f') + def test_create_chassis_uuid(self): + uuid = data_utils.rand_uuid() + _, chassis = self.create_chassis(uuid=uuid) + self.assertEqual(uuid, chassis['uuid'])