@@ -19,13 +19,15 @@ def test_adding_bios_name(mocker, caplog):
1919 node_uuid = uuidutils .generate_uuid ()
2020 mock_context = mocker .Mock ()
2121 mock_node = mocker .Mock (id = 1234 )
22+ mock_node .name = "Dell-CR1MB0"
2223 mock_task = mocker .Mock (node = mock_node , context = mock_context )
2324 mock_port = mocker .Mock (
2425 uuid = uuidutils .generate_uuid (),
2526 node_id = node_uuid ,
2627 address = "11:11:11:11:11:11" ,
2728 extra = {},
2829 )
30+ mock_port .name = "some-arbitrary-name"
2931
3032 mocker .patch (
3133 "ironic_understack.port_bios_name_hook.ironic_ports_for_node" ,
@@ -35,6 +37,7 @@ def test_adding_bios_name(mocker, caplog):
3537 PortBiosNameHook ().__call__ (mock_task , _INVENTORY , {})
3638
3739 assert mock_port .extra == {"bios_name" : "NIC.Integrated.1-1" }
40+ assert mock_port .name == "Dell-CR1MB0:NIC.Integrated.1-1"
3841 mock_port .save .assert_called ()
3942
4043
@@ -44,13 +47,15 @@ def test_removing_bios_name(mocker, caplog):
4447 node_uuid = uuidutils .generate_uuid ()
4548 mock_context = mocker .Mock ()
4649 mock_node = mocker .Mock (id = 1234 )
50+ mock_node .name = "Dell-CR1MB0"
4751 mock_task = mocker .Mock (node = mock_node , context = mock_context )
4852 mock_port = mocker .Mock (
4953 uuid = uuidutils .generate_uuid (),
5054 node_id = node_uuid ,
5155 address = "33:33:33:33:33:33" ,
5256 extra = {"bios_name" : "old_name_no_longer_valid" },
5357 )
58+ mock_port .name = "original-name"
5459
5560 mocker .patch (
5661 "ironic_understack.port_bios_name_hook.ironic_ports_for_node" ,
@@ -59,5 +64,6 @@ def test_removing_bios_name(mocker, caplog):
5964
6065 PortBiosNameHook ().__call__ (mock_task , _INVENTORY , {})
6166
67+ assert mock_port .name == "original-name"
6268 assert "bios_name" not in mock_port .extra
6369 mock_port .save .assert_called ()
0 commit comments