def test_prefix_everything(self): node_info = node.Node(mock.Mock(), dict(uuid='NNN')) data = {'boot_interface': '01-aa-bb-cc-dd-ee-ff', 'inventory': {'bmc_address': '1.2.3.4'}} self.assertEqual('[node: NNN MAC aa:bb:cc:dd:ee:ff BMC 1.2.3.4]', utils.processing_logger_prefix(node_info=node_info, data=data))
def test_prefix_NodeInfo_instance(self): node_info = node_cache.NodeInfo('NNN') self.assertEqual('[node: NNN state None]', utils.processing_logger_prefix(node_info=node_info))
def test_prefix_uuid_not_str(self): node_info = node.Node(mock.Mock(), dict(uuid=None)) self.assertEqual('[node: None]', utils.processing_logger_prefix(node_info=node_info))
def test_prefix_only_mac(self): data = {'boot_interface': '01-aa-bb-cc-dd-ee-ff'} self.assertEqual('[node: MAC aa:bb:cc:dd:ee:ff]', utils.processing_logger_prefix(data=data))
def test_prefix_only_uuid(self): node_info = node.Node(mock.Mock(), dict(uuid='NNN')) self.assertEqual('[node: NNN]', utils.processing_logger_prefix(node_info=node_info))
def test_prefix_only_bmc(self): data = {'inventory': {'bmc_address': '1.2.3.4'}} self.assertEqual('[node: BMC 1.2.3.4]', utils.processing_logger_prefix(data=data))
def test_prefix_NodeInfo_instance_with_state(self): node_info = node_cache.NodeInfo('NNN', state='foobar') self.assertEqual('[node: NNN state foobar]', utils.processing_logger_prefix(node_info=node_info))
def test_prefix_no_info(self): self.assertEqual('[unidentified node]', utils.processing_logger_prefix())
def test_prefix_NodeInfo_instance(self): node_info = node_cache.NodeInfo('NNN') self.assertEqual('[node: NNN]', utils.processing_logger_prefix(node_info=node_info))