Skip to content

Commit

Permalink
Merge pull request sonic-net#14 from Azure/device_info_test_fix
Browse files Browse the repository at this point in the history
Remove the test_get_platform_info tests whichis not present in sonic-buildimage/202205
  • Loading branch information
judyjoseph authored Sep 1, 2022
2 parents 5379cae + 6d30308 commit fb399a9
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/sonic-py-common/tests/device_info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,27 +141,6 @@ def test_is_chassis(self, mock_platform_info):
assert device_info.is_packet_chassis() == False
assert device_info.is_chassis() == False

@mock.patch("sonic_py_common.device_info.ConfigDBConnector", autospec=True)
@mock.patch("sonic_py_common.device_info.get_sonic_version_info")
@mock.patch("sonic_py_common.device_info.get_machine_info")
@mock.patch("sonic_py_common.device_info.get_hwsku")
def test_get_platform_info(self, mock_hwsku, mock_machine_info, mock_sonic_ver, mock_cfg_db):
mock_cfg_inst = mock_cfg_db.return_value
mock_cfg_inst.get_table.return_value = {"localhost": {"switch_type": "npu"}}
mock_sonic_ver.return_value = SONIC_VERISON_YML_RESULT
mock_machine_info.return_value = {"onie_platform" : "x86_64-mlnx_msn2700-r0"}
mock_hwsku.return_value = "Mellanox-SN2700"
for _ in range(0,5):
hw_info_dict = device_info.get_platform_info()
assert hw_info_dict["asic_type"] == "mellanox"
assert hw_info_dict["platform"] == "x86_64-mlnx_msn2700-r0"
assert hw_info_dict["hwsku"] == "Mellanox-SN2700"
assert hw_info_dict["switch_type"] == "npu"
assert mock_sonic_ver.called_once()
assert mock_machine_info.called_once()
assert mock_hwsku.called_once()
mock_cfg_inst.get_table.assert_called_once_with("DEVICE_METADATA")

@classmethod
def teardown_class(cls):
print("TEARDOWN")

0 comments on commit fb399a9

Please sign in to comment.