Merge "This adds a tempest test for creating a chassis with a specific UUID."

This commit is contained in:
Jenkins 2017-03-13 17:35:03 +00:00 committed by Gerrit Code Review
commit 8e14f21c15
3 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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'])