From 4c40701ffb9e4a313c1a511d5f6eabcb6a7a4f8a Mon Sep 17 00:00:00 2001 From: PJHsieh <49477291+PJHsieh@users.noreply.github.com> Date: Thu, 16 May 2024 05:59:28 +0000 Subject: [PATCH 1/2] [Component]Fix test_get_firmware_update_notification fail Erro Log: > pytest_assert(isinstance(notif, STRING_TYPE), "Component {}: Firmware update notification appears to be incorrect from image {}".format(i, image)) E Failed: Component 0: Firmware update notification appears to be incorrect from image current Refer to API get_firmware_update_notification header, shall return 'None' instead of None. """ Retrieves a notification on what should be done in order to complete the component firmware update Args: image_path: A string, path to firmware image Returns: A string containing the component firmware update notification if required. By default 'None' value will be used, which indicates that no actions are required """ --- sonic_platform_base/component_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 8f3887f95..a751f9608 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -76,7 +76,7 @@ def get_firmware_update_notification(self, image_path): A string containing the component firmware update notification if required. By default 'None' value will be used, which indicates that no actions are required """ - return None + return 'None' def install_firmware(self, image_path): """ From 6e575ed4fe41fcf01400e984aa6eabb319ee55db Mon Sep 17 00:00:00 2001 From: PJHsieh <49477291+PJHsieh@users.noreply.github.com> Date: Mon, 24 Jun 2024 01:01:42 +0000 Subject: [PATCH 2/2] Resolve code coverage error by a new unit test case --- tests/component_base_test.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/component_base_test.py diff --git a/tests/component_base_test.py b/tests/component_base_test.py new file mode 100644 index 000000000..3c4fe17db --- /dev/null +++ b/tests/component_base_test.py @@ -0,0 +1,7 @@ +from sonic_platform_base.component_base import ComponentBase + +class TestComponentBase: + + def test_get_firmware_update_notification(self): + cpnt = ComponentBase() + assert(cpnt.get_firmware_update_notification(None) == "None")