Add test for chassis-node-list
Change-Id: If35dad99a8e3cdd169827bd84dbe25fa0e83d031 Closes-Bug: #1563745
This commit is contained in:
parent
de258235bc
commit
e9cd32f7e9
|
@ -181,7 +181,7 @@ class FunctionalTestBase(base.ClientTestBase):
|
|||
self.assertEqual(node_show_states[key], node_show[key])
|
||||
|
||||
def assertNodeValidate(self, node_validate):
|
||||
"""Assert that node_validate is able to validate all interfaces present.
|
||||
"""Assert that all interfaces present are valid.
|
||||
|
||||
:param node_validate: output from node-validate cmd
|
||||
"""
|
||||
|
@ -258,6 +258,14 @@ class FunctionalTestBase(base.ClientTestBase):
|
|||
def validate_node(self, node_id):
|
||||
return self.ironic('node-validate', params=node_id)
|
||||
|
||||
def list_node_chassis(self, chassis_uuid, params=''):
|
||||
return self.ironic('chassis-node-list',
|
||||
params='{0} {1}'.format(chassis_uuid, params))
|
||||
|
||||
def get_nodes_uuids_from_chassis_node_list(self, chassis_uuid):
|
||||
chassis_node_list = self.list_node_chassis(chassis_uuid)
|
||||
return [x['UUID'] for x in chassis_node_list]
|
||||
|
||||
def list_driver(self, params=''):
|
||||
return self.ironic('driver-list', params=params)
|
||||
|
||||
|
|
|
@ -82,3 +82,33 @@ class ChassisSanityTestIronicClient(base.FunctionalTestBase):
|
|||
self.assertEqual('test-chassis', updated_chassis['description'])
|
||||
self.assertNotEqual(self.chassis['description'],
|
||||
updated_chassis['description'])
|
||||
|
||||
def test_chassis_node_list(self):
|
||||
"""Test steps:
|
||||
|
||||
1) create chassis in setUp()
|
||||
2) create 3 nodes
|
||||
3) update 2 nodes to be included in chassis
|
||||
4) check if 2 nodes are added to chassis
|
||||
5) check if 1 nodes isn't added to chassis
|
||||
"""
|
||||
node1 = self.create_node()
|
||||
node2 = self.create_node()
|
||||
|
||||
# This node is created to show that it won't be present
|
||||
# in the chassis-node-list output
|
||||
|
||||
node3 = self.create_node()
|
||||
updated_node1 = self.update_node(node1['uuid'],
|
||||
'add chassis_uuid={0}'
|
||||
.format(self.chassis['uuid']))
|
||||
updated_node2 = self.update_node(node2['uuid'],
|
||||
'add chassis_uuid={0}'
|
||||
.format(self.chassis['uuid']))
|
||||
nodes = [updated_node1['uuid'], updated_node2['uuid']]
|
||||
nodes.sort()
|
||||
nodes_uuids = self.get_nodes_uuids_from_chassis_node_list(
|
||||
self.chassis['uuid'])
|
||||
nodes_uuids.sort()
|
||||
self.assertEqual(nodes, nodes_uuids)
|
||||
self.assertNotIn(node3['uuid'], nodes_uuids)
|
||||
|
|
Loading…
Reference in New Issue