Fix damodel list return None error When has a compute node
Reason: When there is a compute node but no virtual machine, the command 'watcher datamodel list' should display the information of the compute node instead of return None. Change-Id: Id5ff7f08ac8a9883af9f0313785b756d813ed5a2 Closes-Bug: #1844948
This commit is contained in:
@@ -85,6 +85,17 @@ class TestModel(base.TestCase):
|
||||
result_keys = result[0].keys()
|
||||
self.assertEqual(sorted(expected_keys), sorted(result_keys))
|
||||
|
||||
# test compute node has no instance
|
||||
mock_instances.return_value = []
|
||||
|
||||
expected_keys = ['node_uuid']
|
||||
|
||||
result = model_root.ModelRoot().to_list()
|
||||
self.assertEqual(1, len(result))
|
||||
|
||||
result_keys = result[0].keys()
|
||||
self.assertEqual(expected_keys, list(result_keys))
|
||||
|
||||
def test_get_node_by_instance_uuid(self):
|
||||
model = model_root.ModelRoot()
|
||||
uuid_ = "{0}".format(uuidutils.generate_uuid())
|
||||
|
||||
Reference in New Issue
Block a user